if (a>b) { y=a; a=b; b=y; } if(a>c) { y=a; a=c; c=y; } if (b>c) { y=b; b=c; c=y; } printf("%d %d %d",a,b,c);
#include<stdio.h> void sort(int a,int b,int c) { int y; if (a>b) { y=a; a=b; b=y; } if(a>c) { y=a; a=c; c=y; } if (b>c) { y=b; b=c; c=y; } printf("%d %d %d",a,b,c); } main() { int a,b,c; printf("请输入三个数:"); scanf("%d%d%d",&a,&b,&c); sort(a,b,c); }