If you don't save the values you've put in, you can only calculate min, max, average, range, not the standard deviation.
If you don't need the standard deviation it is enough to us a code like this.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(){
int i, n = 3;
float min, max = 0, sum = 0, average = 0, range = 0, measurments;
min = 3.4028234E38;
printf("\nnumber of elements: ");
scanf("%d", &n);
/**then read in the values */
for (i = 0; i < n ; i++)
{
printf("\ninput number %d: ", i);
scanf("%f",&measurments);
sum += measurments;
if (i > 0)
{
average = sum / (i + 1);
range = max - min;
}
if (measurments > max) max = measurments;
if (measurments < min) min = measurments;
printf("max: %f min: %f average: %f range: %f\n", max, min, average, range);
}
return 0;
}
But it is useful when you compare more random samples by working in quality assurance
that the random samples have the same size(number of elements).
example:
To control a diameter of a bore in a part made by a lathe machine
needs to have the same size of the number of parts (may be 5 or 6 parts)
you control every 2 hours or after produce 200 parts.
to compare the standard deviation or other values of
a random sample witch includes 5 workpieces
a random sample including 12 workpieces
and
a random sample including 8 workpieces
It would be a delusion of wrong statistical variances.