fork download
  1. #include <stdio.h>
  2.  
  3. void swap(int *a,int *b);
  4. void sort(int *a,int *b);
  5. int main(void) {
  6. // your code goes here
  7. int a,b;
  8. scanf("%d%d",&a,&b);
  9. sort(&a,&b);
  10. printf("(左から大きい順) a = %d b = %d",a,b);
  11. return 0;
  12. }
  13.  
  14. void swap(int *a,int *b){
  15.  
  16. int w;
  17. w = *a;
  18. *a = *b;
  19. *b = w;
  20.  
  21.  
  22. }
  23. void sort(int *a,int *b){
  24.  
  25. if(*a < *b){
  26. swap(a,b);
  27. }
  28.  
  29.  
  30. }
  31.  
Success #stdin #stdout 0.01s 5280KB
stdin
3
8
stdout
(左から大きい順) a = 8 b = 3