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

Popular posts from this blog

java - SSE Emitter : Manage timeouts and complete() -

jquery - uncaught exception: DataTables Editor - remote hosting of code not allowed -

java - How to resolve error - package com.squareup.okhttp3 doesn't exist? -