fork download
  1. #include<stdio.h>
  2.  
  3. void scanfall(int*x,int*y,int*z);
  4. void ascend(int*x,int*y,int*z);
  5. void swap(int*x,int*y);
  6.  
  7. int main (void){
  8.  
  9. int a,b,c;
  10.  
  11. scanfall(&a,&b,&c);
  12.  
  13. ascend(&a,&b,&c);
  14.  
  15. printf("昇順:%d %d %d\n",a,b,c);
  16.  
  17. return 0;
  18.  
  19.  
  20. }
  21. void scanfall(int*x,int*y,int*z){
  22.  
  23. scanf("%d %d %d",x,y,z);
  24.  
  25. }
  26.  
  27. void ascend(int*x,int*y,int*z){
  28.  
  29. if(*x>*y){
  30. swap(x,y);
  31. }
  32. if(*y>*z){
  33. swap(y,z);
  34. }
  35. if(*x>*y){
  36. swap(x,y);
  37. }
  38.  
  39. }
  40.  
  41. void swap(int*x,int*y){
  42. int w=*x;
  43. *x=*y;
  44. *y=w;
  45. }
Success #stdin #stdout 0s 5396KB
stdin
1
8
2
stdout
昇順:1 2 8