+ 1
Why the output is showing NO?
main() { float a=1.1; if(a==1.1) printf("yes"); else printf("no"); }
3 Respuestas
+ 2
Because the 1.1 in the if statement is a double, which has a more precise and accurate representation of the float used in the declaration of a.
Try with
if(a==1.1f)
the f suffix forces the compiler to treat 1.1 as a float.
+ 1
Thanks@ AndreaC...😊😊😊
0
You're welcome.