Average operator in Linq

Gopesh9
Posted by Gopesh9 under LINQ category on | Points: 40 | Views : 1393
The Average operator in Linq is used get the average of all the values in the list or array.

int[] numbers = { 6, 2, 1, 1, 9, 8, 2, 7, 2, 0 }; 
double avg = numbers.Average();
Console.WriteLine("The average of all the numbers in the list is ", avg);

Comments or Responses

Login to post response