double s = 0.320166
I want to round off this value to exactly 3 decimal places. To do this, I am using this code
int v = s * 1000;
s = double(v)/1000;
When I display s
, I am getting this result 0.32
.
It is not displaying the 0 at the end. I want to display 0.320
exactly 3 decimal places. I know the result is right, but is there anyway that 0
at the end can also display?