#include<stdio.h>
#include<math.h>
int main()
{
double rate, capital, deposit;
//rate -> 存款利率, capital -> 本金, deposit -> 本息之和
short year;
char c;
printf("Input rate, year, capital:");
scanf("%lf,%d,%lf", &rate, &year, &capital);
//
printf("Compound interest (Y/N)?" );
scanf(" %c", &c);
if(c=='y'||c=='Y')//按复利计算方式计算
{
deposit=capital*pow((1+rate), year);
printf("deposit = %.4lf\n", deposit);
}
else if(c=='n'||c=='N')//按普通计息方式计算
{
deposit=capital*(1+rate*year);
printf("deposit = %.4lf\n", deposit);
}
//
return 0;
}