Advertisement
remote87

Sort Three Numbers

Sep 3rd, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _07.SortThreeNumbers
  8. {
  9.     class SortThreeNumbers
  10.     {
  11.         static void Main()
  12.         {
  13.             Console.Write("Enter first number: ");
  14.             double a = double.Parse(Console.ReadLine());
  15.             Console.Write("Enter second number: ");
  16.             double b = double.Parse(Console.ReadLine());
  17.             Console.Write("Enter third number: ");
  18.             double c = double.Parse(Console.ReadLine());
  19.             if ((a > b) && (a > c))
  20.             {
  21.                 if (b > c)
  22.                 {
  23.                     Console.WriteLine("{0} {1} {2}", a, b, c);
  24.                 }
  25.                 else
  26.                 {
  27.                     Console.WriteLine("{0} {1} {2}", a, c, b);
  28.                 }
  29.             }
  30.             else if ((b > a) && (b > c))
  31.             {
  32.                 if (a > c)
  33.                 {
  34.                     Console.WriteLine("{0} {1} {2}", b, a, c);
  35.                 }
  36.                 else
  37.                 {
  38.                     Console.WriteLine("{0} {1} {2}", b, c, a);
  39.                 }
  40.             }
  41.             else if ((c > a) && (c > b))
  42.             {
  43.                 if (a > b)
  44.                 {
  45.                     Console.WriteLine("{0} {1} {2}", c, a, b);
  46.                 }
  47.                 else
  48.                 {
  49.                     Console.WriteLine("{0} {1} {2}", c, b, a);
  50.                 }
  51.             }
  52.         }
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement