+ 6
What will be the output and why?
#include <iostream> using namespace std; int main() { float a = 0.1; double b = 0.1; if(a==b){ cout <<"Values are Equal."; }else{ cout<<"These values are not Equal."; } return 0; }
4 ответов
+ 2
As the datatypes of the two variables are different, hence the above code will produce "These values are not equal".
float store values with only 7 significant digits. On the other hand double allows to store bigger range and 15 digits precision. Both datatypes are all together different datatypes hence values represented in these datatype can't be identical even if both are same.
0
these values are not equal
0
these values are not equal
0
These values are not equal