0

Why output of the following code is false ?

#include<stdio.h> //#include<conio.h> int main(){ float f=0.1; if(f==0.1) printf("True"); else printf("False"); return 0; }

14th Apr 2023, 10:05 AM
Hrutik Bhalerao
Hrutik Bhalerao - avatar
1 Respuesta
+ 10
f is a float. 0.1 is a double. Also see here: https://www.geeksforgeeks.org/comparison-float-value-c/
14th Apr 2023, 10:28 AM
Lisa
Lisa - avatar