作者:小勺年 | 来源:互联网 | 2023-10-12 11:04
#include
int main()
{
int a,b,c,t;
printf("请输入三个数由小到大排序:\n");
scanf("%d %d %d",&a,&b,&c);
if(a>b)
{
t = a;
a = b;
b = t;
}
if(a>c)
{
t = a;
a = c;
c = t;
}
if(b>c)
{
t = b;
b = c;
c = t;
}
printf("排序后的顺序为:\n");
printf("%d %d %d",a,b,c);
return 0;
}
运行结果如下