0
I wanna know the best explanation of the output of this code
#include<stdio.h> int main() { float a=0.9; if(a==0.9) printf("Hello"); else printf("World") ; return 0; }
5 odpowiedzi
+ 4
It's because of float accuracy. In fact a is not 0.9 but 0.89..... (look in the code).Just declare "a" as double which has more accuracy and you'll achieve what you want. Hope it helps you 😉
https://code.sololearn.com/ch8au03xP5OK/?ref=app
+ 2
That's a goodie. Thanks TheWh¡teCat :)
+ 2
You are welcome Deepraj Baidya 👍
+ 1
I know the solution, just wanted to know the explanation of the output. Anyway, thanks