TO FIND ARITHMETIC MEAN BY STEP DEVIATION METHOD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// STEP DEVIATION METHOD | |
//X=A+ (sum(fd')/N) *c | |
#include<iostream> | |
#include<conio.h> | |
using namespace std; | |
int main() | |
{ | |
int n,i,mid,l,h,amean; | |
float mean,c,m[20],f[20],d[20],dz[20],profd[20],sf=0,sfd=0; | |
cout<<"Developed by: Raja Vikrant Sharma"; | |
cout<<"\nEnter number of terms : "; | |
cin>>n; | |
for(i=0;i<n;i++) | |
{ | |
cout<<"\nEntry: "<<i+1<<"\nEnter lower limit: "; | |
cin>>l; | |
cout<<"\nEnter Upper Limt: "; | |
cin>>h; | |
m[i]=(l+h)/2;//mid value | |
cout<<"\nEnter [ "<<l<<"-"<<h<<" ]Frequency: "; | |
cin>>f[i]; | |
sf=sf+f[i];//sum of frequency | |
} | |
c=m[1]-m[0];//calculating deviation c | |
mid=n/2; | |
amean=m[mid-1];//according to array location | |
cout<<"\nAssummed Mean :"<<amean; | |
for(int k=0;k<n;k++) | |
{ | |
d[k]=m[k]-amean;// Taking out d=m-A | |
dz[k]=d[k]/c ; | |
} | |
cout<<"\n|M\t|F\t|D\t|D'\t|\n"; | |
cout<<"---------------------------------\n"; | |
for(i=0;i<n;i++) | |
{ | |
cout<<"| "<<m[i]<<"\t| "<<f[i]<<"\t| "<<d[i]<<"\t| "<<dz[i] <<"\t|\n"; | |
profd[i]=f[i]*dz[i]; | |
sfd=sfd+profd[i]; | |
} | |
cout<<"\nTotal Freq. = "<<sf<<"\nSum of Freq.x d :"<<sfd; | |
mean=amean+((sfd/sf)*c); | |
cout<<"\n\nMean of the given data is :"<<mean; | |
getch(); | |
return (0); | |
} |
Comments
Post a Comment
Thanks for the comment and don't forget to subscribe.