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