using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
namespace Csharp_Sum_ArrayList
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("\n\n== ArrayList Sum Example ==n");
Console.WriteLine("\n\n== ArrayList Sum Example Using Sum Method");
int[] array = { 25, 85, 95, 87,25,87,96,25,45 };
int TotalValue = array.Sum();
Console.WriteLine("\n\n Total Values of array elements: {0}",TotalValue);
Console.WriteLine("\n\n== ArrayList Sum Example Using For Loop");
int total = 0;
for (int counter = 0; counter < array.Length; counter++)
total += array[counter];
Console.WriteLine("\n\n Total Values of array elements: {0}", total);
Console.ReadKey();
}
}
}