Advertisement
rosenrusev

Sort3NumbersWithNestedIfs

Mar 21st, 2014
1,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Sort3NumbersWithNestedIfs
  4. {
  5. class Sort3NumbersWithNetsedIfs
  6. {
  7. static void Main()
  8. {
  9. double a = double.Parse(Console.ReadLine());
  10. double b = double.Parse(Console.ReadLine());
  11. double c = double.Parse(Console.ReadLine());
  12.  
  13. if ((a > b) && (a > c))
  14. {
  15. if (b > c)
  16. {
  17. Console.WriteLine("{0} {1} {2}", a, b, c);
  18. }
  19. else
  20. {
  21. Console.WriteLine("{0} {1} {2}", a, c, b);
  22. }
  23. }
  24. else if ((b > a) && (b > c))
  25. {
  26. if (a > c)
  27. {
  28. Console.WriteLine("{0} {1} {2}", b, a, c);
  29. }
  30. else
  31. {
  32. Console.WriteLine("{0} {1} {2}", b, c, a);
  33. }
  34. }
  35. else if ((c > a) && (c > b))
  36. {
  37. if (a > b)
  38. {
  39. Console.WriteLine("{0} {1} {2}", c, a, b);
  40. }
  41. else
  42. {
  43. Console.WriteLine("{0} {1} {2}", c, b, a);
  44. }
  45. }
  46. }
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement