The title requires calculating the principal and interest of bank deposits, calculated as sum = money × (1 + rate) year, which is the principal and interest when the sum total of deposits maturity (before tax), the deposit amount is Money, year of the deposit is , rate is the annual interest rate.
Input formats:
On a single line in the order given two positive integers money, year and a positive real number rate, separated by a space.
Output formats:
Press the "sum = principal and interest" in the format of the output line, wherein the principal and interest of two decimals, please note that the left and right of the equal sign have a space.
Sample input:
1000 3 0.025
Sample output:
sum = 1076.89
#include<stdio.h>
#include<math.h>
int main()
{
int year,money;
float rate,sum;
scanf("%d %d %f",&money,&year,&rate);
sum=money*pow(1+rate,year);
printf("sum = %.2f",sum);
return 0;
}