SOURCE CODE OUTPUT
#include<iostream>
using namespace std;
int main()
{
int a[50],sum=0,n;
float avg;
cout<<"How many numbers to be entered ";
cin>>n;
cout<<"Enter the numbers ";
for(int i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
avg=sum/(n*1.0);
cout<<"Average = "<<avg;
return 0;
}
using namespace std;
int main()
{
int a[50],sum=0,n;
float avg;
cout<<"How many numbers to be entered ";
cin>>n;
cout<<"Enter the numbers ";
for(int i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
avg=sum/(n*1.0);
cout<<"Average = "<<avg;
return 0;
}
Any questions regarding to program please write in comments.
No comments:
Post a Comment