Advertisement
Guest User

Medián

a guest
Feb 27th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int a,b,c,k=0;
  7. while(1)
  8. {
  9.  
  10. scanf("%d %d %d",&a,&b,&c);
  11. if ( a == 0 && b == 0 && c == 0) break;
  12.  
  13. k=0;
  14.  
  15. if ( a >= b )
  16. {
  17. a^=b;
  18. b^=a;
  19. a^=b;
  20. k++;
  21. }
  22. if ( a >= c )
  23. {
  24. a^=c;
  25. c^=a;
  26. a^=c;
  27. k++;
  28. }
  29. if ( b >= c )
  30. {
  31. b^=c;
  32. c^=b;
  33. b^=c;
  34.  
  35. k++;
  36. }
  37. if (k == 1 || k == 2 || k == 3 || k== 0 ) printf("%d\n",b);
  38. else printf("%d\n",c);
  39.  
  40. }
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement