Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ArrSumMaxMinLastFirstLINQ
- {
- class ArrSumMaxMinMaxLINQ
- {
- static void Main()
- {
- PrintFirstLastMaxMinAveregeElement();
- }
- public static void PrintFirstLastMaxMinAveregeElement()
- {
- int n = int.Parse(Console.ReadLine());
- int[] ArrElements = new int[n];
- for (int i = 0; i < n; i++)
- {
- ArrElements[i] = int.Parse(Console.ReadLine());
- }
- Console.WriteLine("First element - {0}",ArrElements.First());
- Console.WriteLine("Last element - {0}",ArrElements.Last());
- Console.WriteLine("Max - {0}",ArrElements.Max());
- Console.WriteLine("Min - {0}",ArrElements.Min());
- Console.WriteLine("Average - {0}",ArrElements.Average());
- Console.WriteLine("Sum of all elements in Array - {0}",ArrElements.Sum());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement