输入三个整数x,y,z,请把这三个数由小到大输出。
输入格式:
在一行中直接输入3个整数,之间各用一个空格间隔。
输出格式:
在一行中按照“x=最小值,y=次小值, z=最大值”的顺序输出结果,最大值、次大值和最小值均原样输出,没有宽度控制。
#include <stdio.h>
int main()
{
int x, y, z,temp;
scanf("%d %d %d", &x, &y, &z);
if (x > y)
{
temp = x;
x = y;
y = temp;
}
if (x > z)
{
temp = x;
x = z;
z = temp;
}
if (y > z)
{
temp = y;
y = z;
z = temp;
}
printf("x=%d,y=%d,z=%d", x, y, z);
return 0;
}