Advertisement
Lisaveta777

Prata exs 9 6

Aug 31st, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void sort_it(float *,float *,float *);
  4. void sw(float *,float *);
  5.  
  6. int main()
  7. {
  8.     float x,y,z;
  9.     scanf("%f %f %f",&x,&y,&z);
  10.     sort_it(&x,&y,&z);
  11.     printf("%f %f %f\n",x,y,z);
  12.  
  13.     return 0;
  14. }
  15. void sw(float *k,float *l)
  16. {
  17.     float temp;
  18.     temp = *k;
  19.     *k = *l;
  20.     *l = temp;
  21. }
  22. void sort_it(float *a, float *b, float *c)
  23. {
  24.    
  25.     if(*a > *b)
  26.     {
  27.         sw(a,b);
  28.     }
  29.     if(*b > *c)
  30.     {
  31.         sw(b,c);
  32.     }
  33.     if(*a > *b)
  34.     {
  35.         sw(a,b);
  36.     }
  37.  
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement