Advertisement
Mario_Ankona

Array Data

Jul 22nd, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.88 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 arrayData
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] array = Console.ReadLine().Split().Select(int.Parse).ToArray();
  14.             string command = Console.ReadLine();
  15.             if (command == "All")
  16.             {
  17.                 Console.WriteLine(string.Join(" ", array.OrderBy(x => x).Where(x => x > array.Average()).ToArray()));
  18.             }
  19.             else if (command == "Min")
  20.             {
  21.                 Console.WriteLine(string.Join(" ", array.Where(x => x > array.Average()).Min()));
  22.             }
  23.             else if (command == "Max")
  24.             {
  25.                 Console.WriteLine(string.Join(" ", array.Where(x => x > array.Average()).Max()));
  26.             }
  27.  
  28.         }
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement