Advertisement
nmnikolov

djumi91 - 03. Min_Max_Sum_AverageOfN (Array)

Nov 9th, 2014
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.55 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. class Min_Max_Sum_AverageOfN
  5. {
  6.     static void Main()
  7.     {
  8.         int n = int.Parse(Console.ReadLine());
  9.         int[] array = new int[n];
  10.  
  11.         for (int i = 0; i < n; i++)
  12.         {
  13.             array[i] = int.Parse(Console.ReadLine());
  14.         }
  15.  
  16.         Array.Sort(array);
  17.  
  18.         Console.WriteLine("min = " + array[0]);
  19.         Console.WriteLine("max = " + array[n-1]);
  20.         Console.WriteLine("sum = " + array.Sum());
  21.         Console.WriteLine("avg = {0:f2} ", array.Sum()/(double)n);
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement