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. scanfall(&a,&b,&c);
  11. ascend(&a,&b,&c);
  12.  
  13. printf("a=%d b=%d c=%d",a,b,c);
  14.  
  15. return 0;
  16. }
  17.  
  18.  
  19. void scanfall(int *x,int *y,int *z)
  20. {
  21. scanf("%d",&*x);
  22. scanf("%d",&*y);
  23. scanf("%d",&*z);
  24. }
  25.  
  26. void ascend(int *x,int *y,int *z)
  27. {
  28. if(*x<=*z && *z<=*y)
  29. {
  30. swap(z,y);
  31. }
  32. else if(*y<=*x && *x<=*z)
  33. {
  34. swap(x,y);
  35. }
  36. else if(*y<=*z && *z<=*x)
  37. {
  38. swap(x,y);
  39. swap(y,z);
  40. }
  41. else if(*z<=*x && *x<=*y)
  42. {
  43. swap(z,x);
  44. swap(y,z);
  45. }
  46. else if(*z<=*y && *y<=*x)
  47. {
  48. swap(x,z);
  49. }
  50. }
  51.  
  52. void swap(int *x ,int*y )
  53. {
  54. int w;
  55.  
  56. w=*x;
  57. *x=*y;
  58. *y=w;
  59. }
Success #stdin #stdout 0s 5308KB
stdin
3
2
1
stdout
a=1 b=2 c=3