Advertisement
obedmarsh

01. Array Data

Jul 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.98 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Globalization;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace _07.TravellCompany
  8. {
  9.  
  10.     class Program
  11.     {
  12.         static void Main(string[] args)
  13.         {
  14.             List<int> list = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
  15.             string com = Console.ReadLine();
  16.             double av = list.Average();
  17.             List<int> list1 = new List<int>();
  18.             list1 = list.Where(x => x >= (int)av).Select(x => x).ToList();
  19.  
  20.  
  21.             switch (com)
  22.             {
  23.                 case "Min":
  24.                     Console.WriteLine(list1.Min());
  25.                     break;
  26.                 case "Max":
  27.                     Console.WriteLine(list1.Max());
  28.                     break;
  29.                 case "All":
  30.                     Console.WriteLine(string.Join(" ", list1.OrderBy(x => x)));
  31.                     break;
  32.             }
  33.  
  34.  
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement