| 网站首页 | 业界新闻 | 小组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛

#include <stdio.h>
#include <stdlib.h>

int main()
{
{    double rate,capital;
float deposit;
int year;
char a;

printf("Input rate, year, capital:");
scanf("%lf,%d,%lf",&rate,&year,&capital);
getchar();
printf("Compound interest (Y/N)?" );
scanf(" %c",&a);
switch(a){
case 'Y':
printf("deposit = %.4f\n",deposit=capital*pow(1+rate,year));
break;

case 'N':deposit=capital*(1+rate*year);
printf("deposit = %.4f\n",deposit=capital*(1+rate*year));
break;}
return 0;
}
return 0;
}

```#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main()
{
double rate,capital;
float deposit;
int year;
char a;

printf("Input rate, year, capital: ");
scanf("%lf%d%lf",&rate,&year,&capital);
//printf("%f\t%d\t%f\n", rate, year, capital);
getchar();
printf("Compound interest (Y/N)?: " );
scanf("%c",&a);
//printf("%c", a);
switch(a){
case 'Y':
printf("deposit = %.4f\n",deposit=capital*pow(1+rate,year));
break;

case 'N':deposit=capital*(1+rate*year);
printf("deposit = %.4f\n",deposit=capital*(1+rate*year));
break;}
return 0;
}```

• 5
• 1/1页
• 1