+ 2

What should be the output and why?

int main(){ float a= 0.7; if(0.7>a) printf("Hi"); else printf("hello"); return 0; }

18th Jan 2018, 3:07 AM
Kishore Kumar Biswas
Kishore Kumar Biswas - avatar
2 Answers
+ 4
You get hello because 0.7 in the if statement is of type double so it gets better accuracy in the number then a float will.
18th Jan 2018, 3:24 AM
John Wells
John Wells - avatar
+ 2
Thank you. But unfortunately the answer is hi. if you have time please try to compile it John Wells and give me a favour. Really I don't why is it hi?
18th Jan 2018, 5:11 AM
Kishore Kumar Biswas
Kishore Kumar Biswas - avatar