Hello all,
I wrote a C program and I compile with Miracle C - a C compiler software, the program was compiled successfully but does not do any calculations under it. All the calculations I put there was not done, I included math.h and stdio.h, is there anything I am doing wrong??
Below is the program:
Code:
/* program to calculate the geometric and arithmetric average of a set of numbers*/
#include <stdio.h>
#include <math.h>
main()
{
float y, x, xavg, xavg1, temp=1.0, sum=0.0;
int count=1, n;
printf ("\nEnter the total items to calculate\n");
scanf ("%d", &n);
while (count<=n)
{
printf ("\nEnter x\n");
scanf ("%f", &x);
temp*=x;
sum+=x;
++count;
};
y = 1/n;
xavg= pow(temp, y);
xavg1= sum/n;
printf ("\nThe geometric average is %f\n", &xavg);
printf ("\nThe arithmetric average is %f\n", &xavg1);
}
I need help urgently!!!!!