zzulioj 1016: Bank interest rate

Topic description
Suppose the annual interest rate of the bank's one-year time deposit is 2.25%, and the deposit principal is deposit yuan. Try programming to calculate and output the sum of principal and interest in n years.

Input
Enter a positive integer and a real number, which represent the number of deposit years and deposit principal, respectively.

Output
Output a double-precision real number with 6 significant digits after the decimal point.

Sample input Copy
2 100
Sample output Copy
104.550625
Tips
Use the mathematical functions in math.h

#include<stdio.h>
#include<math.h>
int main()
{
    
    
	int n;
	double deposit;
	scanf("%d %lf",&n, &deposit);
	printf("%lf\n",pow(1+0.0225,n)*deposit);
	return 0;
}

Guess you like

Origin blog.csdn.net/m0_53024529/article/details/112706305