#include<stdio.h>
#include<math.h>
int main()
{
int x[]={50,72,54,82,93};
int i;
float gm=0,sum=0,logx[5];
printf("\n COMPUTATION OF GEOMETRIC MEAN");
for(i=0;i<5;i++)
{
logx[i]=log(x[i]); /* Calculation of LogX*/
sum=sum+logx[i]; /* Addition of Log(X)*/
}
printf("\n\n\tX\tLOG(X)\n\n");
for(i=0;i<5;i++)
printf("\n\t%d\t%f\n",x[i],logx[i]);
gm=exp(sum/5);
printf("\nSum of LOGX is:-%f",sum);
printf("\nThe Geometric Mean Is:-%f",gm);
return 0;
}
/* OUTPUT:-
COMPUTATION OF GEOMETRIC MEAN
X LOG(X)
50 3.912023
72 4.276666
54 3.988984
82 4.406719
93 4.532599
Sum of LOGX is:-21.116993
The Geometric Mean Is:-68.265099
*/
〉》 👱😉😊〈《
No comments:
Post a Comment
This Blog helps you to learn basics to high level programming coding and practicals.
conceptual understanding