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.  
  8. int main(void) {
  9. int a, b, c;
  10. scanfall(&a, &b, &c);
  11. ascend(&a, &b, &c);
  12. printf("a=%d, b=%d, c=%d\n",a, b, c);
  13. return 0;
  14. }
  15.  
  16. void scanfall(int *x, int *y, int *z){
  17. scanf("%d",&*x);
  18. scanf("%d",&*y);
  19. scanf("%d",&*z);
  20. printf("a=%d, b=%d, c=%d\n",*x, *y, *z);
  21. return;
  22. }
  23. void ascend(int *x, int *y, int *z){
  24. if(*x>*y)swap(x, y);
  25. if(*x>*z)swap(x, z);
  26. if(*y>*z)swap(y, z);
  27. return;
  28. }
  29. void swap(int*x, int*y){
  30. int n=*x;
  31. *x=*y;
  32. *y=n;
  33. return;
  34. }
Success #stdin #stdout 0s 5316KB
stdin
3
2
1
stdout
a=3, b=2, c=1
a=1, b=2, c=3