Advertisement
Guest User

Problem 3. 03.Min, Max, Sum and Average of N Numbers

a guest
Oct 23rd, 2014
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4.     class MinMaxSumAndAverageOfNNumbers
  5.     {
  6.         static void Main()
  7.         {
  8.             Console.WriteLine("Enter the number of \"n\" numbers you want to work with:");
  9.             int length = int.Parse(Console.ReadLine());
  10.             int[] array = new int[10];
  11.             for (int i = 0;i<length ; i++)
  12.             {
  13.                 array[i] = int.Parse(Console.ReadLine());  
  14.             }
  15.             Console.WriteLine(@"min = {0}
  16. max = {1}
  17. sum = {2}
  18. avg = {3}",array.Min(),array.Max(),array.Sum(),array.Average());
  19.         }
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement