+ 1
what is the output for the below code?
#include<stdio.h> int main() { float a=1.1; double b=1.1; if(a==b) { printf("equal"); } else { printf("not equal"); } return 0; }
3 Respuestas
+ 3
Not equal but i like that they will be equal they are not in the some data type.
+ 3
Equal
+ 1
Not equal..
Because you are comparing with float with higher type double. And in memory representation decimal values are stored slightly less or more decimal value on convertion into binary as ex 1.1 (is double value) to float 1.1 as 1.10000000012 or 1.10000089989 like these, there exists a slight difference in decimal point so those not comes to equal..