0
Why the scanf is not storing correct value in variable salary?
Input given is 45689.4527 but output is 45689.453125… https://code.sololearn.com/c8sPyiw1eJnU/?ref=app
5 odpowiedzi
+ 2
Krishna,
I'm just guessing because `double` is capable of handling better precision over `float`. But it was a guess, someone more knowledgeable can answer that doubt in more technical way 👍
+ 1
Try to use `double` instead, I got correct output using `double`.
+ 1
Ipang you're right double gives the correct answer but why the float gives incorrect value ?
+ 1
Okay