fork download
  1. #include <stdio.h>
  2.  
  3. void swap(int *x, int *y){
  4. int tmp = *y;
  5. *y = *x;
  6. *x = tmp;
  7. }
  8.  
  9. int main() {
  10. int a=3;
  11. int b=1;
  12. int c=2;
  13. if(a>b)swap(&a,&b);
  14. if(b>c)swap(&b,&c);
  15. if(a>b)swap(&a,&b);
  16. printf("a=%d, b=%d, c=%d",a,b,c);
  17. // your code goes here
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
a=1, b=2, c=3