Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Order_By_Age
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- List<int> sorted = numbers.OrderByDescending(x => x).ToList();
- if (sorted.Count < 3)
- {
- Console.WriteLine(string.Join(" ", sorted));
- }
- else
- {
- List<int> top3 = sorted.GetRange(0, 3);
- Console.WriteLine(string.Join(" ", top3));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement