Advertisement
damyan91

Untitled

Aug 20th, 2016
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 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.  
  7. namespace _01.Number
  8. {
  9. class Number
  10. {
  11. static void Main()
  12. {
  13. string number = Console.ReadLine();
  14. int count = 0;
  15. int[] arr = number.Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
  16. double average = arr.Average();
  17.  
  18. Array.Sort(arr);
  19. Array.Reverse(arr);
  20.  
  21. if (average <= 1)
  22. {
  23. Console.WriteLine("No");
  24. }
  25. else
  26. {
  27. for (int i = 0; i < arr.Length; i++)
  28. {
  29. if (arr[i] > average)
  30. {
  31. Console.Write(arr[i] + " ");
  32. count++;
  33. if (count == 5)
  34. {
  35. break;
  36. }
  37. }
  38. }
  39. }
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement