帮忙看下哪里出了问题,最后输出最大最小值不对。我C语言新手

来源:百度知道 编辑:UC知道 时间:2024/05/24 20:28:04
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c;
int max,min;
printf("Input three different integers:");
scanf("%d %d %d",&a,&b,&c);
max==a;
min==a;
if(b>max)
max == b;
if(c>max)
max == c;
if(b<min)
min == b;
if(c<min)
min == c;
printf("Sum is %d\n",a+b+c);
printf("Average is %d\n",(a+b+c)/3);
printf("Product is %d\n",a*b*c);
printf("Smallest is %d\n",min);
printf("Largest is %d\n",max);
system("pause");
return 0;
}

#include <stdio.h>
#include <stdlib.h>
int main()
{
int a,b,c;
int max,min;
printf("Input three different integers:");
scanf("%d %d %d",&a,&b,&c);
max=a;
min=a;
if(b>max)
max =b;
if(c>max)
max = c;
if(b<min)
min = b;
if(c<min)
min =c;
printf("Sum is %d\n",a+b+c);
printf("Average is %d\n",(a+b+c)/3);
printf("Product is %d\n",a*b*c);
printf("Smallest is %d\n",min);
printf("Largest is %d\n",max);
system("pause");
return 0;
}
就是把== 改成=就对了。