Adding up the numbers array - CSharp LINQ

CSharp examples for LINQ:Aggregate

Description

Adding up the numbers array

Demo Code



using System;// ww  w . j a v a2s. c  om
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int[] numbers = new[] { 5, 7, 1, 4, 9, 3, 0, 2, 6, 8 };
        var sum = numbers.Sum();
        Console.WriteLine("\tSum of the numbers is {0}", sum);


    }
}

Result


Related Tutorials