1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-23 21:58:41 +00:00
202401-programming-assignments/【实践课外】1.顺序结构/7-2 计算存款利息.c

15 lines
236 B
C
Raw Normal View History

2024-10-16 11:31:55 +00:00
#include <math.h>
#include <stdio.h>
int main() {
double money, year, rate;
scanf("%lf%lf%lf", &money, &year, &rate);
double k = pow(rate + 1, year);
printf("interest = %.2lf\n", money * k - money);
return 0;
}