Menu Close

Find the interest and amount resided in the bank

Ratik a young millionaire deposits $10000 into a bank account paying 7% simple interest per year.  He left the money in for 5 years. He likes to predict the interest and the amount earned by him at the end of 5 years
Can you help him to find the interest and amount resided in his bank acoount after 5 years? 
Functional Description: 

interest = (p * i * t) / 100 and

amount = p + interest.

where p is total principal, i is rate of interest per year, and t is total time in years. 

Input: 
Input has three values representing Principle,Interest per year and Time.

Output:
First Line: Print the interest earned for the principle amount.

Second Line: Print the Total amount earned including interest.
#include <stdio.h>
int main()
{
float p,i,interest,amount;
int t;
scanf("%f %f %d",&p,&i,&t);
interest=p*i*t/100;
amount=p+interest;
printf("Interest after %d Years = $%.2f",t,interest);
printf("\nTotal Amount after %d Years = $%.2f",t,amount);
    return 0;
}

INPUT_1:
10000  7.8  5

OUTPUT:
Interest after 5 Years = $3900.00
Total Amount after 5 Years = $13900.00


INPUT_2:
13000  9  7

OUTPUT:
Interest after 7 Years = $8190.00
Total Amount after 7 Years = $21190.00


INPUT_3:
12500  9.3  7

OUTPUT:
Interest after 7 Years = $8137.50
Total Amount after 7 Years = $20637.50



Morae Q!