when you use division make use float data type. in mean()
and SD()
function you do division by 5
and both operands are int
so change one of those to float. otherwise result will be truncated to be a int
.
You can change /5
to /5.0
or you can use a float
type cast.
The mean
you are getting as 0
since you defined m
as integer int
and using %f
to print it.
int a,b,c,d,e,m;
printf("\nThe sum is %d , mean is %f and standard deviation is %f",sum(a,b,c,d,e),m,SD(a,b,c,d,e,m));
m
is mean
so make it a float type variable.
int a,b,c,d,e;
float m;