#include<stdio.h>
#include<stdlib.h>
int main() {
int a, b, c,max;
printf("这个程序将用来给三个输入的数排序\n");
printf("_______________________________\n");
scanf_s("%d %d %d", &a, &b, &c);
max=findmax(a,b,c);
if (max==a) {
if (max > b) {
if (b > c) {
printf("%d %d %d",a,b,c);
}
else {
printf("%d %d %d", a,c,b);
}
}
}
else if (max==b) {
if (max > a) {
if (a > c) {
printf("%d %d %d", b, a, c);
}
else {
printf("%d %d %d", b, c, a);
}
}
}
else if (max==c) {
if (max > a) {
if (a > b) {
printf("%d %d %d", c, a, b);
}
else {
printf("%d %d %d", c, b, a);
}
}
}
return 0;
}
int findmax(int a,int b,int c) {
int max;
if (a > b) {
max = a;
if (max > c) {
}
else if (max < c) {
max = c;
}
else {
}
}
else if (a < b) {
max = b;
if (max > c) {
}
else if (max < c) {
max = c;
}
else {
}
}
else {
max = b;
if (max > c) {
}
else if (max < c) {
max = c;
}
else {
}
}
return max;
}
09-27
7209
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)