Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Text.RegularExpressions;
  7. using System.Numerics;
  8.  
  9. namespace string_regEx
  10. {
  11. class Program
  12. {
  13. static void Main(string[] args)
  14. {
  15. long[] input = Console.ReadLine()
  16. .Split()
  17. .Select(long.Parse)
  18. .ToArray();
  19. while (input.Length < 5)
  20. {
  21. Console.WriteLine("No");
  22. input = Console.ReadLine()
  23. .Split()
  24. .Select(long.Parse)
  25. .ToArray();
  26. }
  27.  
  28. double inputAvarage = input.Average();
  29. List<long> aboveAvarage = new List<long>();
  30.  
  31. foreach (var item in input)
  32. {
  33. if (item > inputAvarage)
  34. {
  35. aboveAvarage.Add(item);
  36. }
  37. }
  38.  
  39. Console.WriteLine(string.Join(" ", aboveAvarage.OrderByDescending(X => X).Take(5)));
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement