Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Numbers
- {
- class MainClass
- {
- public static void Main()
- {
- List<int> listOfNumbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- double averageNum = listOfNumbers.Average();
- var newListNumsGreaterThanAverage = listOfNumbers.Where(x => x > averageNum).ToList();
- var newListDescending = newListNumsGreaterThanAverage.OrderByDescending(x => x).ToList();
- if (newListDescending.Count == 0)
- {
- Console.WriteLine($"No");
- }
- else
- {
- List<int> result= newListDescending.Take(5).ToList();
- Console.WriteLine(string.Join(" ",result));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement