C语言题目求助
#include<stdio.h>int main()
{
float a,b,c,d,e,f,g,i;
double A,B,C;
a=3.7;
b=7.0;
c=1.3;
d=8.0;
e=2.4;
f=9.0;
g=6.3;
i=0.5;
A=(a+0.5*d+0.5*f);
B=(1.5*c+0.25*e+2.5*g);
C=(5*g+10*i);
printf("小明要付的钱:0.2f%\n",A);
printf("小红要付的钱:0.2f%\n",B);
printf("小甲鱼要付的钱:0.2f%\n",C);
return 0;
}
打反了兄弟%0.2f不是0.2f% printf()打印格式错误,%号要在前边 #include<stdio.h>
int main()
{
float a,b,c,d,e,f,g,i;
double A,B,C;
a=3.7;
b=7.0;
c=1.3;
d=8.0;
e=2.4;
f=9.0;
g=6.3;
i=0.5;
A=(a+0.5*d+0.5*f);
B=(1.5*c+0.25*e+2.5*g);
C=(5*g+10*i);
printf("小明要付的钱:%.f\n",A);
printf("小红要付的钱:%.f\n",B);
printf("小甲鱼要付的钱:%.f\n",C);
return 0;
}
应该是这样才对 送分题 啊涂涂 发表于 2018-11-7 11:40
打反了兄弟%0.2f不是0.2f%
非常感谢
页:
[1]