1.整个过程
首先定义三个变量abc,然后假设输出的按从大到小顺序为abc,之后利用if语句进行调整,此时定义一个变量tmp作为桥梁将abc联系起来
2.实现程序
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
int a = 0;
int b = 0;
int c = 0;
scanf("%d%d%d",&a,&b,&c);//输入
if (a < b)//调整
{
int tmp = a;
a = b;
b = tmp;
}
if (a < c)
{
int tmp = a;
a = c;
c = tmp;
}
if (b < c)
{
int tmp = b;
b = c;
c = tmp;
}
printf("%d %d %d\n", a, b, c);//输出
system("pause");
return 0;
}