Find Average of Numbers Using Arrays Program in C++


Prev Tutorial Next Tutorial

C++ Program to Find Average of Numbers Using Arrays

Average of numbers is calculated by adding all the numbers and then dividing the sum by count of numbers available.
In below code we receive integer input from user and storing it in array. Then we will find the sum of all array elements using for loop and finally calculate the average of N input numbers stored in an array.

To understand this code you need basic knowledge about Array in C++ and For Loop in C++.


The numbers whose average is to be calculated are:
10, 20, 30, 40, 50
Sum of numbers = 150
Average of numbers = 150/5 = 30

C++ Program to Find Average of Numbers Using Arrays


void main()
int i, count, sum, inputArray[500];
float average;

cout<<"Enter number of Elements: ";
cin >> count;

cout<<"Enter " << count << " any Elements in Array:\n";
for(i = 0; i < count; i++) {
cin >> inputArray[i];

sum = 0;
// Find sum of all array elements
for(i = 0; i < count; i++) {
sum += inputArray[i];

average = (float)sum / count;
cout << "Average: " << average;



Enter number of Elements: 5
Enter any Elements in Array: 
Average: 30
search array element program in c++
Prev Tutorial Next Tutorial


Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: or 9999595223

Pure VPN Privide Lowest Price VPN Just @ $1.65. Per Month with Non Detected IP Lowest Price Non Detected IP VPN

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements

Buy Websites 9999595223
wifi cctv camera

Wifi CCTV Camera RS:1200 to 2499. Contact no. 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: or 9999595223 Try this Keyword C++ Programs