LINQ: Mean





LINQ: Mean, Median, and Mode.

Mean is the statistical average of a set of numbers. This one is easy with LINQ because of the Average function.

Implementation


int[] Avge= { 1,2,3};

double mean = Avge.Average(); 

The result is:

Mean: 2

This code uses the Average extension method on the IEnumerable class to calculate the mean, or average, of the numbers.

HappyCoding ! 😉

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: