*Arithmetic Mean of N numbers*

*Arithmetic Mean of N numbers*

Write a C++ Program to Calculate Arithmetic Mean of N numbers. Here’s simple C++ Program to Calculate Arithmetic Mean of N numbers in C++ Programming Language.

*Numbers in C++*

*Numbers in C++*

Normally, when we work with Numbers, we use primitive data types such as int, short, long, float and double, etc. The number data types, their possible values and number ranges have been explained while discussing C++ Data Types.

To calculate arithmetic mean of numbers in C++ Programming, you have to ask to the user to enter number size then ask to enter the numbers of that size.

To calculate arithmetic mean of all numbers, first perform addition of all the numbers, then make a variable responsible for the arithmetic mean and place addition/size in a variable say **armean** (arithmetic mean), then display the result.

Here is source code of the C++ Program to Calculate Arithmetic Mean of N numbers. The C++ program is successfully compiled and run(on Codeblocks) on a Windows system. The program output is also shown in below.

**SOURCE CODE : :**

**SOURCE CODE : :**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
/* C++ Program to Calculate Arithmetic Mean of N numbers */ #include<iostream> using namespace std; int main() { int n, i, arr[50], sum=0; cout<<"\nHow many number you want to enter :: "; cin>>n; cout<<"\nEnter "<<n<<" Numbers Below :: \n"; for(i=0; i<n; i++) { cout<<"\nEnter [ "<<i+1<<" ] Number :: "; cin>>arr[i]; sum=sum+arr[i]; } int armean=sum/n; cout<<"\nArithmetic Mean of [ "<<n<<" ] Numbers = "<<armean<<"\n"; return 0; } |

**OUTPUT : :**

**OUTPUT : :**

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
/* C++ Program to Calculate Arithmetic Mean of N numbers */ How many number you want to enter :: 5 Enter 5 Numbers Below :: Enter [ 1 ] Number :: 1 Enter [ 2 ] Number :: 2 Enter [ 3 ] Number :: 3 Enter [ 4 ] Number :: 4 Enter [ 5 ] Number :: 5 Arithmetic Mean of [ 5 ] Numbers = 3 Process returned 0 |

Above is the source code for C++ Program to Calculate Arithmetic Mean of N numbers which is successfully compiled and run on Windows System.The Output of the program is shown above .

If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may * Contact Us* through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.

**Thanks for reading the post….**

## Leave a Reply