Calculation of interest on deposits

The interest of the subject of the present claims, is calculated as interest = money × (1 + rate) year -money, where interest is interest (before tax) when the deposit matures, money deposit amount is, year of a deposit, rate is the annual interest rate.

Input formats:

Three input order given positive real money, year rate and in a row, separated by spaces.

Output formats:

Press Format "interest = interest" in the output line, wherein two decimal places of interest.

Sample input:

1000 3 0.025

Sample output:

interest = 76.89

#include<stdio.h>
#include<math.h>
int main()
{
	int money;
	float year,rate,sum,interest;
	scanf("%d %f %f",&money,&year,&rate);
	sum=money*pow(1+rate,year);
	interest=sum-money;
	printf("interest = %.2f",interest);
	return 0;
}
Published 43 original articles · won praise 26 · views 204

Guess you like

Origin blog.csdn.net/Noria107/article/details/104213447