#include<iostream>
#include<conio.h>
#include<iomanip>
#include<windows.h>
using namespace std;
int i;
int main()
{
void line(void);
float sum=0;
int n;
cout<<"Enter number of observations:";
cin>>n;
float num[n];
cout<<"Enter "<<n<<" data values:";
for(i=0;i<n;i++)
{
cin>>num[i];
sum+=num[i];
}
system("cls"
);
line();
cout<<setw(5)<<"S.No."<<setw(15)<<"Observations";
line();
for(i=0;i<n;i++)
cout<<setw(5)<<i+1<<setw(9)<<num[i]<<endl;
line();
cout<<setw(5)<<n<<setw(9)<<sum;
line();
cout<<"\nAverage="<<setprecision(2)<<sum/n;
getch();
return sum/n;
}
void line(void)
{
cout<<endl;
for(i=0;i<25;i++)
cout<<'_';
cout<<endl;
}
#include<conio.h>
#include<iomanip>
#include<windows.h>
using namespace std;
int i;
int main()
{
void line(void);
float sum=0;
int n;
cout<<"Enter number of observations:";
cin>>n;
float num[n];
cout<<"Enter "<<n<<" data values:";
for(i=0;i<n;i++)
{
cin>>num[i];
sum+=num[i];
}
system("cls"
);
line();
cout<<setw(5)<<"S.No."<<setw(15)<<"Observations";
line();
for(i=0;i<n;i++)
cout<<setw(5)<<i+1<<setw(9)<<num[i]<<endl;
line();
cout<<setw(5)<<n<<setw(9)<<sum;
line();
cout<<"\nAverage="<<setprecision(2)<<sum/n;
getch();
return sum/n;
}
void line(void)
{
cout<<endl;
for(i=0;i<25;i++)
cout<<'_';
cout<<endl;
}