中国农业银行2015年10月利息计算程序
#include "stdio.h"
int main( )
{ int year,type;
float money,rate,interest,total; /* 本金 月利率 本利合计*/
printf("请输入存款类型(数字):1,活期;2,定期:");
scanf("%d",&type);/*选择活期还是定期*/
printf("\n请输入存款金额与存款年限:");
scanf("%f %d", &money, &year);/* 输入本金和年 */
if(type==1)rate=0.0030;
if(type==2)
{
if(year==1)rate=0.0175; /* 根据年限定利率 */
else if(year==2)rate=0.0225;
else if(year==3||year==4)rate=0.0275;
else if(year==5)rate=0.0275;
else rate=0.0275;
}
interest=money*rate*year;
total=money+interest;
printf("\n%d年后的本利和为%f元,其中利息为%f元", year,total,interest);
return 0;
}
软件业务请联系QQ:3121432464“正聪科技客服”
posted on 2017-10-05 18:17 sunshineman1986 阅读(122) 评论(0) 收藏 举报
浙公网安备 33010602011771号