您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

C语言公式计算利息金额

2024/3/20 7:22:34发布36次查看
问题编写一个c程序,计算存款金额在一些年后的增加利息
解决方案计算利息的公式为 −
m=((r/100) * t);a=p*exp(m);
where r= rate of interest
t=no. of years
p=amount to be deposited
m=temporary variable
a= final amount after interest
算法startstep 1: declare double variablesstep 2: read amount to be depositedstep 3: read rate of intereststep 4: read years you want to depositstep 5: calculate final amount with interest i. m=((r/100) * t); ii. a=p*exp(m);step 6: print final amountstop
示例#include<stdio.h>#include<math.h>#include<ctype.h>int main(){ double p,r,t,a,m; printf("amount to be deposit in the bank: "); scanf("%lf",&p); printf("
enter the rate of interest:"); scanf("%lf",&r); printf("
how many years you want to deposit:"); scanf("%lf",&t); m=((r/100) * t); a=p*exp(m); printf("
amount after %0.1lf years with interest is:%0.2lf",t,a); return 0;}
输出amount to be deposit in the bank: 50000enter the rate of interest:6.5how many years you want to deposit:5amount after 5.0 years with interest is:69201.53
以上就是c语言公式计算利息金额的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product