输入三个整数,找出最大值:
#include <stdio.h>
int main()
{
int a,b,c;
int max;
int temp;
printf("请输入三个整数:");
scanf("%d%d%d",&a,&b,&c);
if(a>b)
{
max=a;
temp=a;
a=b;
b=temp;
}
else
{
max=b;
temp=b;
b=a;
a=temp;
}
if(max<c)
{
max=c;
temp=c;
c=b;
b=temp;
}
printf("%d %d %d",s,b,c);
printf("最大值max=%d",max);
return 0;
}
结果如下: