C语言哪里错了啊。。。。提示说错误 2.c 22: Do-while 语句缺少 ')'在 main 函数中,我看不出来有少啊,,
#include<stdio.h>intmain(){doubleP,i=1,r1=0.0414,r2=0.0468,r3=0.054,r4=0.0585,r5=0.00...
#include<stdio.h>
int main(){
double P,i=1,r1=0.0414,r2=0.0468,r3=0.054,r4=0.0585,r5=0.0072;
int n,k,j=1;
scanf("%d",&n);
switch(n)
{
case5:
P=1000*(1+n*r4);
printf("到期金额为:%d/n",P);break;
case2:
k=1000*(1+n*r2);
P=k*(1+3*r3);
printf("到期金额为:%d/n",P);break;
case3:
k=1000*(1+n*r3);P=k*(1+2*r2);
printf("到期金额为:%d/n",P);break;
case1:
P=1000*(1+r1)*(1+r1)*(1+r1)*(1+r1)*(1+r1);
printf("到期金额为:%d/n",P);break;
default:do{i=i*(1+r5/4);j++;}
while(j>4n+1);
P=1000*i;
printf("到期金额为:%d/n",P);
}
return 0;
} 展开
int main(){
double P,i=1,r1=0.0414,r2=0.0468,r3=0.054,r4=0.0585,r5=0.0072;
int n,k,j=1;
scanf("%d",&n);
switch(n)
{
case5:
P=1000*(1+n*r4);
printf("到期金额为:%d/n",P);break;
case2:
k=1000*(1+n*r2);
P=k*(1+3*r3);
printf("到期金额为:%d/n",P);break;
case3:
k=1000*(1+n*r3);P=k*(1+2*r2);
printf("到期金额为:%d/n",P);break;
case1:
P=1000*(1+r1)*(1+r1)*(1+r1)*(1+r1)*(1+r1);
printf("到期金额为:%d/n",P);break;
default:do{i=i*(1+r5/4);j++;}
while(j>4n+1);
P=1000*i;
printf("到期金额为:%d/n",P);
}
return 0;
} 展开
2个回答
展开全部
4n+1 不对
#include<stdio.h>
int main(){
double P,i=1,r1=0.0414,r2=0.0468,r3=0.054,r4=0.0585,r5=0.0072;
int n,k,j=1;
scanf("%d",&n);
switch(n)
{
case 5:
P=1000*(1+n*r4);
printf("到期金额为:%d/n",P);break;
case 2:
k=1000*(1+n*r2);
P=k*(1+3*r3);
printf("到期金额为:%d/n",P);break;
case 3:
k=1000*(1+n*r3);P=k*(1+2*r2);
printf("到期金额为:%d/n",P);break;
case 1:
P=1000*(1+r1)*(1+r1)*(1+r1)*(1+r1)*(1+r1);
printf("到期金额为:%d/n",P);break;
default:
do{i=i*(1+r5/4);j++;}
while(j>4*n+1);
P=1000*i;
printf("到期金额为:%d/n",P);
}
return 0;
}
#include<stdio.h>
int main(){
double P,i=1,r1=0.0414,r2=0.0468,r3=0.054,r4=0.0585,r5=0.0072;
int n,k,j=1;
scanf("%d",&n);
switch(n)
{
case 5:
P=1000*(1+n*r4);
printf("到期金额为:%d/n",P);break;
case 2:
k=1000*(1+n*r2);
P=k*(1+3*r3);
printf("到期金额为:%d/n",P);break;
case 3:
k=1000*(1+n*r3);P=k*(1+2*r2);
printf("到期金额为:%d/n",P);break;
case 1:
P=1000*(1+r1)*(1+r1)*(1+r1)*(1+r1)*(1+r1);
printf("到期金额为:%d/n",P);break;
default:
do{i=i*(1+r5/4);j++;}
while(j>4*n+1);
P=1000*i;
printf("到期金额为:%d/n",P);
}
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询