fork download
  1. #include <stdio.h>
  2.  
  3. void deascend(int *x, int *y, int *z);
  4. void swap(int *a, int *b);
  5.  
  6. int main(void)
  7. {
  8. int n1,n2,n3;
  9.  
  10. printf("n1:"); scanf("%d", &n1);
  11. printf("n2:"); scanf("%d", &n2);
  12. printf("n3:"); scanf("%d", &n3);
  13.  
  14. deascend(&n1, &n2, &n3);
  15.  
  16. printf("%d, %d, %d\n", n1, n2, n3);
  17.  
  18. return 0;
  19. }
  20.  
  21. void deascend(int *x, int *y, int *z)
  22. {
  23. if (*x < *y)
  24. swap(x, y);
  25.  
  26. if (*x < *z)
  27. swap(x, z);
  28.  
  29. if (*y < *z)
  30. swap(y, z);
  31. }
  32.  
  33. void swap(int *a, int *b)
  34. {
  35. int tmp;
  36.  
  37. tmp = *a;
  38. *a = *b;
  39. *b = tmp;
  40. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
n1:n2:n3:1226168256, 32767, 21852