入门级别, 希望得到指导
这是算银行存款利息与本金的合计,不知道为什么输出的结果与算法算出的答案不对,求各位大神帮忙解答一下。#include<stdio.h>
#include<math.h>
int main()
{
float money,year ;
printf("输入存钱的本金和期限:");
scanf("%f,%f",&money,&year);
if (year<1)
{
printf("money=%f\n",money);
}
else if(year<2&&year>=1)
{
money*= pow(1+0.0225,year);
printf("money=%f\n",money);
}
else if(year<3)
{
money*= pow(1+0.0243,year);
printf("money=%f\n",money);
}
else if(year>=3&&year<5)
{
money*= pow(1+0.027,year);
printf("money=%f\n",money);
}
else if(year>=5&&year<8)
{
money*= pow(1+0.0288,year);
printf("money=%f\n",money);
}
else if (year>=8)
{
money*= pow(1+0.03,year);
printf("money=%f\n",money);
}
}
[此贴子已经被作者于2019-4-10 22:31编辑过]