This code prints "What is this". But It seems to me the result should be "lol"
Why is that ?? Plz help .
float a = 0.7;
if(a < 0.70)
printf("what is this?");
This is a precision problem of floating point types like float and double. 0.7 can't be stored exactly. When you write 0.7 or 0.70 the type is a double. The extra zero doesn't make a difference. float usually have less precision than double so when you assign 0.7 (a double) to a (a float) it will store 0.7 less exact, and apparently as a smaller value. If you change the type of a to double you will get the expected output.