Advertisement
Aborigenius

ArrayData

Aug 15th, 2017
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 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 MoreExercises
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             List<int> data = Console.ReadLine().Split(' ')
  14.                 .Select(int.Parse).ToList();
  15.  
  16.             data = data.Where(x => x >= data.Average()).ToList();
  17.  
  18.             string input = Console.ReadLine().ToLower();
  19.  
  20.             if (input == "min")
  21.             {
  22.                 Console.WriteLine(string.Join(" ", data.Min()));
  23.                             }
  24.             if (input == "max")
  25.             {
  26.                 Console.WriteLine(string.Join(" ", data.Max()));
  27.             }
  28.             if (input == "all")
  29.             {
  30.                 Console.WriteLine(string.Join(" ", data.OrderBy(num => num)));
  31.             }
  32.             //    Console.WriteLine($"Average = {data.Average()}");
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement