本題目要求計算存款利息,計算公式為1,其中interest為存款到期時的利息(稅前),money是存款金額,year是存期,rate是年利率。
輸入格式:
輸入在一行中順序給出三個正實數money、year和rate,以空格分隔。
輸出格式:
在一行中按“interest = 利息”的格式輸出,其中利息保留兩位小數。
輸入樣例:
1000 3 0.025
輸出樣例:
interest = 76.89
#include<stdio.h>
#include<math.h>
int main()
{
double money,year,rate,interest;
scanf("%lf%lf%lf",&money,&year,&rate);
interest=money*( pow((1+rate),year ))-money;
printf("interest = %.2lf",interest);
return 0;
}