C double not working as expect -
i writing need divide 29 10. when , store in double, outputs 2.0000 instead of 2.9. can explain why happening , how fix it?
double = 29/10; output: 2.0000
the double
works expected, it's not assigning expression of type double
.
what assign int
, result of dividing 29
, int
, 10
, int
. 2
, because remainder discarded when divide integers.
changing 29
29.0
or 10
10.0
fix problem.
Comments
Post a Comment