You are trying to use an sprintf() %d format to print a non-integer value. When you do that, sprintf() uses %e format instead. If you want to print out in floating point, code a %e or %f or %g format.
Remember that the mean of integral values need not be integral itself. For example the mean of 1 and 2 is not going to be an integer.
Best Answer