题目:输入三个整数.分别放在变量a,b,c中,然后把输入的数据重新按有小到大的顺序放在变量a,b,c中,最后输出a,b,c中的值!
代码:
#include <stdio.h>
int main()
{
int a , b , c , t;
printf("input a , b , c:");
scanf("%d %d %d",&a,&b,&c);
printf("a = %d , b = %d , c = %d \n",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("a = %d , b = %d , c = %d \n",a , b ,c);
}
各位大佬如果还有什么好的方法可以指教哦!大家一起讨论学习!