๐Ÿ”’ Closed JAVA OOP

Status
Not open for further replies.

NAMII-CHAN

Established
Sino po may alam dito?. Tambak kami sa coding activities ngayooon huhu sana may makatulong

Interest is compounded annually at 10% by a certain bank. Make a program that would
input an amount and a number of years (the program should test that both are positive)
and output how much the original amount will be worth after that period.
 
C++:
#include<stdio.h>
#include<math.h>

int main()
{
        float interest_rate = 0.10;//10%
        float amount;
        int numberOfYears;
        printf("Enter Amount: ");
        scanf("%f", &amount);
        printf("Enter Number of Years: ");
        scanf("%d", &numberOfYears);

        //calculating compound interest

        float finalAmount = (amount * pow((1 + interest_rate), numberOfYears) - 1);
        printf("Final Amount: $ %.2f\n",finalAmount);
        return 0;
}
 
Status
Not open for further replies.

About this Thread

  • 1
    Replies
  • 552
    Views
  • 2
    Participants
Last reply from:
PHC-LEIIKUN

Online now

Members online
1,012
Guests online
748
Total visitors
1,760

Forum statistics

Threads
2,275,585
Posts
28,964,275
Members
1,231,875
Latest member
cjpeligro123
Back
Top