7-10 计算存款利息
分数 10

全屏浏览
作者 颜晖
单位 浙大城市学院
本题目要求计算存款利息,计算公式为interest=money×(1+rate)
year
−money,其中interest为存款到期时的利息(税前),money是存款金额,year是存期,rate是年利率。
输入格式:
输入在一行中顺序给出三个正实数money、year和rate,以空格分隔。
输出格式:
在一行中按“interest = 利息”的格式输出,其中利息保留两位小数。
输入样例:
1000 3 0.025
输出样例:
interest = 76.89
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
栈限制
8192 KB
Select is focused , press Down to open the menu,
C (gcc)






1
2
3
4
5
6
7
8
9
10
11
#include<stdio.h>
#include<math.h>
int main()
{
double interest,rate,a,money,year;
scanf("%lf %lf %lf",&money,&year,&rate);
a=pow((1+rate),year);
interest=money*a-money;
printf("interest = %.2lf",interest);
return 0;
}

测试用例
分数 10

全屏浏览
作者 颜晖
单位 浙大城市学院
本题目要求计算存款利息,计算公式为interest=money×(1+rate)
year
−money,其中interest为存款到期时的利息(税前),money是存款金额,year是存期,rate是年利率。
输入格式:
输入在一行中顺序给出三个正实数money、year和rate,以空格分隔。
输出格式:
在一行中按“interest = 利息”的格式输出,其中利息保留两位小数。
输入样例:
1000 3 0.025
输出样例:
interest = 76.89
代码长度限制
16 KB
时间限制
400 ms
内存限制
64 MB
栈限制
8192 KB
Select is focused , press Down to open the menu,
C (gcc)






1
2
3
4
5
6
7
8
9
10
11
#include<stdio.h>
#include<math.h>
int main()
{
double interest,rate,a,money,year;
scanf("%lf %lf %lf",&money,&year,&rate);
a=pow((1+rate),year);
interest=money*a-money;
printf("interest = %.2lf",interest);
return 0;
}

测试用例