Advertisement
elena1234

Largest-3-Numbers

Oct 25th, 2020
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Largest3Numbers
  6. {
  7.     class MainClass
  8.     {
  9.         public static void Main()
  10.         {
  11.            List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
  12.            var filteredList = numbers.OrderByDescending(x => x).ToList();
  13.            Console.WriteLine(string.Join(" ",filteredList.Take(3)));
  14.         }
  15.  
  16.     }
  17.  
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement