c语言程序题:从键盘上任输入三个实数,求出最大数和最小数的和值,

144
提问者
2023-03-15 16:12 悬赏 0财富值 阅读 1303回答 2

#include void main(){int a,b,c,d,e;scanf("%d",&a);scanf("%d",&b);scanf(

默认分类
登录 后发表回答
1楼 · 2023-03-15 16:40.采纳回答

#include<stdio.h>
main()
{
float a,b,c,max,min,sum,average;
printf("请输入三个实数,以空格隔开");
scanf("%f %f %f",&a,&b,&c);
max=a;
min=a;
if(b>max) max=b;
if(b<min) min=b;
if(c>max) max=c;
if(c<min) min=c;
sum=min+max;
average=sum/2;
printf("和值为%f\n",sum);
printf("平均值为%f\n",average);
}

int a,b,c,MAX,MIN;sancf("%d%d%d",&a,&b,&c);MAX=MIN=a;if(MAX < b)MAX = b;if(MIN > b) MIN = b;if(MAX < c) MAX = c;if(MIN > c) MIN = c;printf("和=%d,平均=%f",MIN+MAX,((folat)(MAX+MIN))/2);

2楼-- · 2023-03-15 16:43

#include <stdio.h>
void main()
{
int a,b,c,d,e;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
d=a>b? a:b;
d=a>c? a:c;
e=a<c? a:c;
e=a<b? a:b;
printf("max + min=%d\n",d+e);
printf("Average=%d",(d+e)/2);
}

------望采纳!!!