fork(1) download
  1. #include <stdio.h>
  2.  
  3. void swap(int *a,int *b);
  4. int main(void) {
  5. // your code goes here
  6. int a,b;
  7. scanf("%d%d",&a,&b);
  8. swap(&a,&b);
  9. printf("(左から小さい順) a = %d b = %d",a,b);
  10. return 0;
  11. }
  12. void swap(int *a,int *b){
  13.  
  14. if(*a>*b){
  15. int w;
  16. w = *a;
  17. *a = *b;
  18. *b = w;
  19. }
  20.  
  21. }
  22.  
Success #stdin #stdout 0.01s 5308KB
stdin
53
45
stdout
(左から小さい順) a = 45 b = 53