How to find the sum of array using C# .Net
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace array
{
class Program
{
static void Main(string[] args)
{
int temp = 0, n;
int[] no=new int[10];
Console.WriteLine("enter size of array");
n = int.Parse(Console.ReadLine());
Console.WriteLine("enter 10 array element ");
for (int s = 0; s <= 9; s++)
{
no[s] = Convert.ToInt32(Console.ReadLine());
temp+= no[s];
}
Console.WriteLine("sum of {0}",temp);
Console.ReadLine();
}
}
Sign up here with your email
2 comments
Write commentsoutput to aapo bhai
Replyupper dekh bhai....
ReplyConversionConversion EmoticonEmoticon