Given an collection as 10, 12, 8, 5, 5. The objective is to find the average of numbers from the collection of numbers. The below program will do so
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(new List<int>() { 10, 12, 8, 5, 5 }.Average());
Console.ReadKey();
}
}
}
Output: 8