编写一个C语言,输入abc,将他们从大到小排序输出

如题所述

#include <iostream>
#include<stdio.h>
int main(){
int a,b,c,temp;
printf("请输入三个数abc:");
scanf("%d%d%d",&a,&b,&c);
if( b>a ){
temp = a;
a = b;
b = temp;
}
if( c>a ){
temp = a;
a = c;
c = temp;
}
if( c>b ){
temp = b;
b = c;
c = temp;
}
printf("从大到小排序:");
printf("%d %d %d",a,b,c);
system("pause");
return 0;
}
温馨提示:答案为网友推荐,仅供参考
相似回答