**Sum and Average of n numbers using for loop**

**Sum and Average of n numbers using for loop**

Write a C++ Program to Find Sum and Average of n numbers using for loop. Here’s simple Program to Find Sum and Average of n numbers using for loop in C++ Programming Language.

**Average of n numbers**

**Average of n numbers**

- Average of n numbers – The sum of all of the numbers in a list divided by the number of items in that list.

For example, the mean of the numbers 2, 3, 7 is 4 since 2+3+7 = 12 and 12 divided by 3 [there are three numbers] is 4.

Here is source code of the C++ Program to Find Sum and Average of n numbers using for loop. 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 : :**

/* C++ Program to Find Sum and Average of n numbers using for loop */ #include<iostream> using namespace std; int main() { int i,n,x,sum=0; float avg; cout<<"How many numbers u want to enter :: "; cin>>n; for(i=1;i<=n;++i) { cout<<"\nEnter number "<<i<<" :: "; cin>>x; sum+=x; } avg=(float)sum/(float)n; cout<<"\n\nSum of "<<n<<" Numbers :: "<<sum; cout<<"\n\nAverage of "<<n<<" Numbers :: "<<avg; cout<<"\n"; return 0; }

**Output : : **

**Output : :**

/* C++ Program to Find Sum and Average of n numbers using for loop */ How many numbers u want to enter :: 6 Enter number 1 :: 1 Enter number 2 :: 2 Enter number 3 :: 3 Enter number 4 :: 4 Enter number 5 :: 5 Enter number 6 :: 6 Sum of 6 Numbers :: 21 Average of 6 Numbers :: 3.5 Process returned 0

Above is the source code for C++ Program to Find Sum and Average of n numbers using for loop 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….**

Is there any flowchart?

it makes me perfect by writing code and start to develop the software