for an assignment i've been asked to write a program that calculates Geometric and arithmetic mean in regular c. i wrote this function:
double Geometric_mean(int number[], int n) //number[5]={1,2,3,4,5},n=5
{
int i;
double mean = 1;
for (i = 0;i < n;i++)
{
mean =mean*number[i];
}
mean = pow(mean,1/n); //mean=120
return(mean); //mean=1
}
i get the desired result before the pow turns it to 1 instead the of the desired 2.605