Iii) main(){ float me = 1.1; double you = 1.1; if(me==you)printf("I love U");else printf("I hate U");}

I hate U
Explanation:
For floating point numbers (float, double, long double) the values cannot be predicted exactly. Depending on the number of bytes, the precession with of the value represented varies. Float takes 4 bytes and long double takes 10 bytes. So float stores 0.9 with less precision than long double.
Rule of Thumb:
Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .

Questions by Beena   answers by Beena

Showing Answers 1 - 1 of 1 Answers

sreelu

  • Mar 15th, 2006
 

ans is i hate u because the of float and doubles are different. if condition is false.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions