银行整存整取存款不同期限的月息利率分别为:
请根据输入存款的本金和年限,求到期时能从银行得到的利息与本金的合计。(利息的计算公式为:利息=本金×月息利率×12 ×存款年)
#include<stdio.h>#include<stdlib.h>void main(){int year;double input,out;printf("输入存储年份:\n");scanf("%d",&year);printf("输入本金数额:\n");scanf("%lf",&input);if (input<0)printf("本金金额不能为负!\n");else{switch(year){case 1: out=input+input*year*12*0.63/100;printf("%5.2lf",out);break;case 2: out=input+input*year*12*0.66/100;printf("%5.2lf",out);break;case 3: ;case 4: out=input+input*year*12*0.69/100;printf("%5.2lf",out);break;case 5: ;case 6: ;case 7: out=input+input*year*12*0.75/100;printf("%5.2lf",out);break;case 8: out=input+input*year*12*0.84/100;printf("%5.2lf",out);break;default:printf("输入错误!");break;}}}12345678910111213141516171819202122