#include <stdio.h>main(){int i,y;float b,l,total;printf("\nPlease input the cash(yuan) and the year(year=1,2,3,5,8).\n");loop: scanf("%f%d",&b,&y);switch(y){case 1:l=0.0063; break;case 2:l=0.0066; break;case 3:l=0.0069; break;case 5:l=0.0075; break;case 8:l=0.0084; break;default:printf("The year is error! Please input the cash and the year.\n ");goto loop;}total=b;for(i=1;i<=y*12;i++)total=total*(1+l);printf("The total is %f yuan .",total);getchar();getchar();}

评论