adds


Average of a set numbers by C++ Programme

AIM:
To find average of a given set of numbers by using C++ Programme.
REQUISITES:
A PC or laptop, Turbo C++ compiler installed in it.
THEORY:
For a data set, the terms arithmetic mean, mathematical expectation, and sometimes average are used synonymously to refer to a central value of a discrete set of numbers.
If x1,x2,x3…….xn are a set of data, the mean can be calculated as
Xmean=Average=(x1+x2+………….+xn)/n

CODING:
#include<iostream.h>
#include<conio.h>
void main()
{
int a[100],sum=0,n,avg,i;
clrscr();
cout<<"Enter a number :";
cin>>n;
cout<<"Enter " ""<<n<<" ""numbers :"<<endl;
for (i=0;i<n;i++)
{
cin>>a[i];
}
for (i=0;i<n;i++)
{
sum=sum+a[i];
}
avg=sum/n;
cout<<"The average is:"<<avg;
getch();
}
OUTPUT:


Model syllabus (+3): Downoad

List of all practicals:   Download

Syllabus For:                                                      Get all B.Sc Physics Notes

IIT-JAM                                                              CLICK



  • How to Prepare for IIT-JAM  ⇠ ⇠ Click Here

Post a Comment

Previous Post Next Post