Why 5==5.0 , where 5 is integer and 5.0 is floating point??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why 5==5.0 , where 5 is integer and 5.0 is floating point???

17th Oct 2020, 5:10 PM
Ashutosh Patel
Ashutosh Patel - avatar
3 Answers
+ 5
In all languages 5==5.0 will be true . But if u will write like this float a=0.1; if(a==0.1) printf(" true"); else printf (" false"); If you will run this code it will print false not true .
17th Oct 2020, 5:35 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 1
I know mathematically it's true...but based on C language I'm asking
17th Oct 2020, 5:26 PM
Ashutosh Patel
Ashutosh Patel - avatar
0
♨️TEJAS MK-82♨️ what's the reason for this , could u explain??
17th Oct 2020, 6:04 PM
Ashutosh Patel
Ashutosh Patel - avatar