Y0_Kostova

Sort Three Numbers

Oct 8th, 2019
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. namespace SortThreeNumbers
  4. {
  5.     class SortThreeNumbers
  6.     {
  7.         static void Main()
  8.         {
  9.             int a = int.Parse(Console.ReadLine());
  10.             int b = int.Parse(Console.ReadLine());
  11.             int c = int.Parse(Console.ReadLine());
  12.  
  13.  
  14.             for (int i = 0; i < 1; i++)
  15.             {
  16.                
  17.                 if ((a >= b && a > c) || (a > b && a >= c))
  18.                 {
  19.                 Console.WriteLine(a);
  20.                 }
  21.                 else if ((b >= a && b > c) || (b > a && b >= c))
  22.                 {
  23.                 Console.WriteLine(b);
  24.                 }
  25.                 else if ((c >= a && c > b) || (c > a && c >= b))
  26.                 {
  27.                 Console.WriteLine(c);
  28.                 }
  29.                 else if (a==b && a==c)
  30.                 {
  31.                     Console.WriteLine(a);
  32.                 }
  33.  
  34.  
  35.             }
  36.  
  37.  
  38.         }
  39.  
  40.     }    
  41. }
Advertisement
Add Comment
Please, Sign In to add comment