Advertisement
Guest User

SortThreeNumbersWithNestedIf

a guest
Mar 22nd, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. static void Main()
  2.         {
  3.             float a = float.Parse(Console.ReadLine());
  4.             float b = float.Parse(Console.ReadLine());
  5.             float c = float.Parse(Console.ReadLine());
  6.             if (a > b)
  7.             {
  8.                 if (b > c)
  9.                 {
  10.                     Console.WriteLine("{0} {1} {2}", a, b, c);
  11.                 }
  12.                 else
  13.                 {
  14.                     if (a > c)
  15.                     {
  16.                         Console.WriteLine("{0} {1} {2}", a, c, b);
  17.                     }
  18.                     else
  19.                     {
  20.                         Console.WriteLine("{0} {1} {2}", c, a, b);
  21.                     }    
  22.                 }
  23.             }
  24.             else
  25.             {
  26.                 if (c < a)
  27.                 {
  28.                     Console.WriteLine("{0} {1} {2}", b, a, c);
  29.                 }
  30.                 else
  31.                 {
  32.                     if (b < c)
  33.                     {
  34.                         Console.WriteLine("{0} {1} {2}", c, b, a);
  35.                     }
  36.                     else
  37.                     {
  38.                         Console.WriteLine("{0} {1} {2}", b, c, a);
  39.                     }
  40.                 }
  41.             }
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement