Introduction :
C# Program to find sum of elements in a given array, c# program sum of given array elements.Logic to sum of element in array in C# programming.
C# Program to find sum of elements in a given array
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(); } } }
OutPut of Program :
Learn Recommended posts :
C# program to find maximum and minimum element in array
How do you reverse a string in C#
C# program to Check String is palindrom or not
How to print Pyramid Pattern in C#
How do you count the no of digits or character in C#
Factorial Number Program in C# using Recursion
Convert string to char array in C#
Finding the biggest of three numbers in C#
C# Program to Check Whether the Entered Number is an Armstrong Number or Not
1 Comment