要求:输入三个数由小到大排序
#include <stdio.h> int main(int argc, char *argv[]) { int a,b,c,t; 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("%d %d %d",a,b,c); return 0; }