/* 2. PROGRAM TO CALCULATE ARITHMETIC MEAN FOR DISCRETE SERIES*/
#include<stdio.h>
int main()
{
int x[]={1,2,3,4,5,6,7};
int f[]={5,9,12,17,14,10,6};
int i,xf[7],n=0;
float M,sf=0;
printf("\n COMPUTATION OF ARITHMETIC MEAN");
for(i=0;i<7;i++)
{
n=n+f[i]; /* Addition of Frequency */
xf[i]=x[i]*f[i]; /* Multiplication of X and Frequency */
sf=sf+xf[i]; /* Addition of X*Frequency */
}
printf("\n\n\tX\tFrequency\tFX\n\n");
for(i=0;i<7;i++)
printf("\n\t%d\t%d\t\t%d\n",x[i],f[i],xf[i]);
M=sf/n;
printf("\n Total Frequency: -%d",n);
printf("\n Total FX:- %f",sf);
printf("\n Arithmetic Mean Is:- %f",M);
return 0;
}
/* OUTPUT:-
COMPUTATION OF ARITHMETIC MEAN
X Frequency FX
1 5 5
2 9 18
3 12 36
4 17 68
5 14 70
6 10 60
7 6 42
Total Frequency:- 73
Total FX:- 299.000000
Arithmetic Mean Is:- 4.095891
*/
😊😉😦
No comments:
Post a Comment
This Blog helps you to learn basics to high level programming coding and practicals.
conceptual understanding