Advertisement
vencinachev

MinMaxSumAvg-LINQ

Mar 13th, 2022
1,044
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 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 Lists
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] numbers = Console.ReadLine()
  14.                             .Split(' ')
  15.                             .Select(el => int.Parse(el))
  16.                             .ToArray();
  17.             Console.WriteLine($"Min = {numbers.Min()}");
  18.             Console.WriteLine($"Max = {numbers.Max()}");
  19.             Console.WriteLine($"Sum = {numbers.Sum()}");
  20.             Console.WriteLine($"Average = {numbers.Average():F1}");
  21.         }
  22.     }
  23. }
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement