18. Interest Earned Assuming there are no deposits other than the original inves
ID: 3749624 • Letter: 1
Question
18. Interest Earned Assuming there are no deposits other than the original investment, the balance in a savings account after one year may be calculated as Rate T Amount-Principal (1+ Principal is the balance in the savings account, Rate is the interest rate, and r is the number of times the interest is compounded during a year (T is 4 if the interest is compounded quarterly). Write a program that asks for the principal, the interest rate, and the number of times the interest is compounded. It should display a report similar to 4.25% Interest Rate: Times Compounded: Principal: Interest: Amount in Savings: 1043.34 12 $ 1000.00 $ 43.34Explanation / Answer
Answer)
C program for the above implementation:
#include <stdio.h>
#include <math.h>
int main()
{
float principal, rate, time, amount;
printf("Enter the principal :");
scanf("%f", &principal);
printf("Enter the rate :");
scanf("%f", &rate);
printf("Enter the time :");
scanf("%f", &time);
amount = principal * pow((1 + rate / time), time);
printf(" Interest Rate: %0.2f", rate);
printf(" Times compounded: %0.2f", amount/principal);
printf(" Principal: $%0.2f", principal);
printf(" Interest: $%0.2f", amount-principal);
printf(" Amount in Savings $%0.2f", amount);
return 0;
}
Response:
Enter the principal :10000
Enter the rate :10
Enter the time :2
Interest Rate: 10.00
Times compounded: 36.00
Principal: $10000.00
Interest: $350000.00
Amount in Savings $360000.00
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.