SHARE
TWEET

01.Numbers

DorianSlavov Feb 25th, 2017 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. namespace Numbers
  2. {
  3.     using System;
  4.     using System.Collections.Generic;
  5.     using System.Linq;
  6.     using System.Text;
  7.     using System.Threading.Tasks;
  8.  
  9.     class Numbers
  10.     {
  11.         static void Main()
  12.         {
  13.             var nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
  14.             var average = nums.Average();
  15.             var fixedNums = new List<int>();
  16.            
  17.             foreach (var number in nums)
  18.             {
  19.                 if (number>average)
  20.                 {
  21.                     fixedNums.Add(number);
  22.                 }
  23.             }
  24.            
  25.             fixedNums = fixedNums.OrderByDescending(n => n).ToList();
  26.             if (fixedNums.Count < 2)
  27.             {
  28.                 Console.WriteLine("No");
  29.             }
  30.             else
  31.             {
  32.                 Console.WriteLine(string.Join(" ", fixedNums.Take(5)));
  33.             }
  34.         }
  35.     }
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top