(if述句)用两个变数的数值交换对三个变数做排序
#include <stdio.h> int main() { int a,b,c,t; scanf("%d%d%d",&a,&b,&c); printf("Before :%d %d %d\n",a,b,c); if (b > a) { t = b; b = a; a = t; } if (c < a) { t = c; c = a; a = c; } if (c < b) { t = c; c = b; b = t; } printf("After: %d %d %d\n",a,b,c); return 0; }