void main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); } - Q4Interview" /> void main() { float me = 1.1; double you = 1.1; if(me==you) printf("I love U"); else printf("I hate U"); } - Q4Interview" />
Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

C Programming :: Variables & Data Types

2. What will be output of the following "c" code?

#include
void main()

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

Answer: Option A

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.

Important Note:
Never compare or at-least be cautious when using floating point numbers with relational operators (== , >, <, <=, >=,!= ) .

Post Your Answer Here:     

Name *
Email
Alert me

No Discussion on this question yet!