用C语言公式计算利息金额
问题
编写一个C程序来计算几年后增加的存款金额和利息
解决方案
计算利息的公式是-
M=((r/100) * t); A=P*exp(M);
其中r=利率
t=否。年
P=存入金额
M=临时变量
A=利息后的最终金额
算法
START
Step 1: declare double variables
Step 2: read amount to be deposited
Step 3: read rate of interest
Step 4: read years you want to deposit
Step 5: Calculate final amount with interest
I. M=((r/100) * t);
II. A=P*exp(M);
Step 6: Print final amount
STOP示例
#include输出结果#include #include int main(){ double P,r,t,A,M; printf("存入银行的金额: "); scanf("%lf",&P); printf("\n enter the rate of interest:"); scanf("%lf",&r); printf("\n How many years you want to deposit:"); scanf("%lf",&t); M=((r/100) * t); A=P*exp(M); printf("\n amount after %0.1lf years with interest is:%0.2lf",t,A); return 0; }
存入银行的金额: 50000 enter the rate of interest:6.5 How many years you want to deposit:5 amount after 5.0 years with interest is:69201.53
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短