菜鸟第一天,如何快速给三个数字排序,代码如下:
1 #include <stdio.h> 2 3 int main(){ 4 double a, b, c, temp; 5 scanf("%lf%lf%lf", &a, &b, &c); 6 if(a > b){ 7 temp = a; 8 a = b; 9 b = temp; 10 } 11 if(b > c){ 12 temp = b; 13 b = c; 14 c = temp; 15 } 16 if(a > b){ 17 temp = a; 18 a = b; 19 b = temp; 20 } 21 printf("%.2f %.2f %.2f\n", a, b, c); 22 return 0; 23 }