Calculate Sum and Average of an Array in C# – C# Programming Example
Arrays C# Console For Loop

Calculate Sum and Average of an Array in C#

In this article, We will see two programs to find the average of numbers using array. First Program finds the average of specified array elements. The second programs takes the value of n (number of elements) and the numbers provided by user and finds the average of them using array.

Example 1: Program to find the average of numbers using array

C# Code:

Output:

Example 2: Calculate average of numbers entered by user

In this example, we are using Scanner to get the value of n and all the numbers from user.

C# Code:

Output:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: