Enumerable.Average() : Enumerable « System.Linq « C# / C Sharp by API






Enumerable.Average()

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        int[] numbers = { 5, 4, 1, 3, 9, 8, 6, 7, 2, 0 };

        double averageNum = numbers.Average();

        Console.WriteLine("The average number is {0}.", averageNum);
    }
}

   
  








Related examples in the same category

1.Enumerable.Aggregate
2.Enumerable.Cast
3.Enumerable.Count()
4.Enumerable.DefaultIfEmpty
5.Enumerable.Distinct()
6.Enumerable.ElementAt
7.Enumerable.ElementAtOrDefault
8.Enumerable.ElementsAfterSelf
9.Enumerable.Empty
10.Enumerable.First
11.Enumerable.OrderBy
12.Enumerable.Range
13.Enumerable.Repeat
14.Enumerable.Where