TheBulgarianWolf

The three largest numbers

Feb 20th, 2021
742
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace LargestThreeNumbers
  5. {
  6.     class Program
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             Console.WriteLine("Enter your list of numbers: ");
  11.             int[] numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();
  12.             int[] numbersSorted = numbers.OrderByDescending(n => n).ToArray();
  13.             for(int i = 0; i < 3; i++)
  14.             {
  15.                 Console.Write(numbersSorted[i] + " ");
  16.             }
  17.         }
  18.     }
  19. }
  20.  
RAW Paste Data