using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i,n,sum=0;
int[] a = new int[10];
Console.Write("Enter the number of elements: ");
n=int.Parse(Console.ReadLine());
Console.Write("Enter the elements");
for(i=1;i<=n;i++)
{
a[i]=int.Parse(Console.ReadLine());
}
for (i = 1; i<=n; i++)
{
sum = sum + a[i];
}
Console.Write("The sum of the elements is:"+sum);
Console.ReadKey();
}
}
}
/*Do leave a comment if you find this useful*/
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int i,n,sum=0;
int[] a = new int[10];
Console.Write("Enter the number of elements: ");
n=int.Parse(Console.ReadLine());
Console.Write("Enter the elements");
for(i=1;i<=n;i++)
{
a[i]=int.Parse(Console.ReadLine());
}
for (i = 1; i<=n; i++)
{
sum = sum + a[i];
}
Console.Write("The sum of the elements is:"+sum);
Console.ReadKey();
}
}
}
/*Do leave a comment if you find this useful*/