初学者C语言基础
答案:3 悬赏:50 手机版
解决时间 2021-04-13 15:59
- 提问者网友:山高云阔
- 2021-04-12 19:36
初学者C语言基础
最佳答案
- 五星知识达人网友:千夜
- 2021-04-12 20:04
#include
#define min(a,b) (a#define max(a,b) (a>b?a:b)
int main(int argc, char const *argv[])
{ int a,b,c;
printf("input three different number
");
scanf("%d%d%d",&a,&b,&c);
printf("Sum is %d
",a+b+c );
printf("Product is %d
",a*b*c );
printf("Average is %f
",(a+b+c)/3.0 );
printf("Smallest is %d
",min(a,min(b,c)) );
printf("Largest is %d
",max(a,max(b,c)) );
}追问#include
int main()
{int a,b,c,sum,product,average,largest,smallest;
printf("Input three different integers:\n");
scanf("%d%d%d\n",&a,&b,&c);
sum=a+b+c;printf("Sum is %d\n",sum);
product=a*b*c;printf("Product is %d\n",product);
average=(a+b+c)/3;printf("Average is %d\n",average);能运行,但是提交作业是错误的
#define min(a,b) (a#define max(a,b) (a>b?a:b)
int main(int argc, char const *argv[])
{ int a,b,c;
printf("input three different number
");
scanf("%d%d%d",&a,&b,&c);
printf("Sum is %d
",a+b+c );
printf("Product is %d
",a*b*c );
printf("Average is %f
",(a+b+c)/3.0 );
printf("Smallest is %d
",min(a,min(b,c)) );
printf("Largest is %d
",max(a,max(b,c)) );
}追问#include
int main()
{int a,b,c,sum,product,average,largest,smallest;
printf("Input three different integers:\n");
scanf("%d%d%d\n",&a,&b,&c);
sum=a+b+c;printf("Sum is %d\n",sum);
product=a*b*c;printf("Product is %d\n",product);
average=(a+b+c)/3;printf("Average is %d\n",average);能运行,但是提交作业是错误的
全部回答
- 1楼网友:煞尾
- 2021-04-12 22:34
max=a>b?(a>c?a:c):(b>c?b:c);
min=a
min=a
- 2楼网友:街头电车
- 2021-04-12 21:35
请把代码复制上来,帮你改。追问if(a>b){largest=a,smallest=b;}
else{largest=b,smallest=a;}
if(largest>c)printf("Largest is %d\n",largest);
else printf("Largest is %d\n",c);
if(smallest else printf("Smallest is %d\n",c);
return 0;}
else{largest=b,smallest=a;}
if(largest>c)printf("Largest is %d\n",largest);
else printf("Largest is %d\n",c);
if(smallest
return 0;}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯