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. // your code goes here
  9. int x,y,z;
  10. scanfall(&x,&y,&z);
  11. ascend(&x, &y, &z);
  12. ascend(&x, &y, &z);
  13. ascend(&x, &y, &z);
  14.  
  15. printf("%d %d %d", x,y,z);
  16. return 0;
  17. }
  18.  
  19. void scanfall(int *x, int *y, int *z){
  20. scanf("%d",&*x);
  21. scanf("%d",&*y);
  22. scanf("%d",&*z);
  23.  
  24. }
  25. void ascend(int *x, int *y, int *z){
  26. if(*x > *y){
  27. swap(&*x, &*y);
  28. }
  29. else if(*y > *z){
  30. swap(&*y, &*z);
  31. }
  32. }
  33. void swap(int *x, int *y){
  34. int i;
  35. i = *x;
  36. *x = *y;
  37. *y = i;
  38. }
  39.  
  40.  
Success #stdin #stdout 0s 5436KB
stdin
 3 2 1
stdout
1 2 3