NastySwipy

Dictionaries Lambda LINQ - 03. Min, Max, Sum, Average

Apr 23rd, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace _07a_Dictionaries_Lambda_Expressions_LINQ_Lab
  5. {
  6.     class Dictionaries_Lambda_Expressions_LINQ_Lab
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int count = int.Parse(Console.ReadLine());
  11.             int[] numbers = new int[count];
  12.  
  13.             for (int i = 0; i < count; i++)
  14.             {
  15.                 numbers[i] = int.Parse(Console.ReadLine());
  16.             }
  17.             Console.WriteLine("Sum = " + numbers.Sum());
  18.             Console.WriteLine("Min = " + numbers.Min());
  19.             Console.WriteLine("Max = " + numbers.Max());
  20.             Console.WriteLine("Average = " + numbers.Average());
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment