In: Computer Science
2.29 Domain Lab 4.1 -- Compound Interest Calculator Compound Interest Calculator Your program should ask the user (in this order) for: Principal … In this equation, it is expressed as PV Annual Interest Rate Time Period (years) … Note that there are 12 compounding periods per year. So your n value in the equation is years multiplied by 12 Your program should then calculate and display: Total Interest Generated Total Future Value SPECIAL NOTE Make sure to round output to 2 decimal places!
//in C language
//importing header files
#include <stdio.h>
#include <math.h>
//main function
int main()
{
float PV, Interest_rate, year, CompInterest;
//tacking imput principle from user
printf("Enter principle : ");
scanf("%f", &PV);
//tacking imput time in years from user
printf("Enter time in years: ");
scanf("%f", &year);
//tacking imput rateinterest from user
printf("Enter rate: ");
scanf("%f", &Interest_rate);
// equation for calculating compound interest
CompInterest = PV* (pow ((1 + (Interest_rate / (12.0*100.0))),
year*12));
// displaying the result
printf("Result Compound Interest = %.2f", CompInterest);
return 0;
}
------------------------------------------------------------------------------------------------------------------
#in python language
principle_Amount=float(input("Enter amount:"))
time=int(input("Enter time:"))
rate=float(input("Enter Rate:"))
CI=principle_Amount*pow((1+(rate/(12*100))),time*12)
print(CI)