float x,i=~(257<<23),a,s,t;main(int n,char**f){a=-i;f=fopen(f[1],"r"
);for(n=0;fscanf(f,"%f",&x)>0;n++,s+=x,x<i?i=x:0,x>a?a=x:0,t+=x*x);
printf("%d %f %f %f %f\n",n,a,i,s/n,sqrtf(t/n));}
Sorry for the long code. Didn’t have time to make it shorter.
1
solved Read file with floats, calculate size, max, min, mean, median and standard deviaton in C [closed]