How to find the average of int array with Linq in C#

1 Answer

0 votes
using System;
using System.Linq;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] numbers = { 5, 3, 7, 2, 9 };

            Console.WriteLine(numbers.Average()); // 5.2
        }
    }
}

/*
run:
   
5.2
 
*/


answered Mar 4, 2015 by avibootz

Related questions

...