0
Why "false" executed? Can any one explain it.
#include<iostream> //#include<stdio.h> using namespace std; int main(){ double a=0.1,b=0.2,c=0.3; if(a+b==c) cout<<"true"; else cout<<"false"; }
2 Respuestas
+ 5
Because, a+b != c.
So, the else part is executed
https://www.sololearn.com/Discuss/2836796/?ref=app
+ 4
Gaurav Prajapati ,
see the attached code and run it, so you can see the difference between the assigned value and the result of the addition. the values are not the same!
https://code.sololearn.com/ct8jP8kgBJG1/?ref=app