C++ Code To Find The Average Of The Numbers Entered::

C++ Code To Find The Average Of The Numbers Entered::
============================================

#include <iostream>
using namespace std;
int main()
{
    int a;
    double sum=0;
    cout<<"Enter The Number of Terms : ";

    cin>>a;
    double array[a];
    ///////  Entering values into an array
    for(int p=0; p<a; p++)
    {
        cout<<"Number "<<p+1<<" : ";
        cin>>array[p];
    }
    ///////////// Answer Printing
    for(int p=0; p<a; p++)
    {
    sum+=array[p];
    }
    cout<<"\nThe Average Of Entered "<<a<<" Numbers is : " << (sum/a)<<endl<<endl;
}

==================================
For More Help Post Your Comments Below:
==================================

No comments:

Post a Comment