main()

{

float me = 1.1;

double you = 1.1;

if(me==you)

printf("I love U");

else

printf("I hate U");

}



main() { float me = 1.1; double you = 1.1; if(me==you) printf("I lov..

Answer / susie

Answer :

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 (== , >, <,
<=, >=,!= ) .

Is This Answer Correct ?    12 Yes 0 No

Post New Answer

More C Code Interview Questions

What is "far" and "near" pointers in "c"...?

3 Answers  


main() { int a=10,*j; void *k; j=k=&a; j++; k++; printf("\n %u %u ",j,k); }

1 Answers  


How to read a directory in a C program?

4 Answers  


What is the problem with the following code segment? while ((fgets(receiving array,50,file_ptr)) != EOF) ;

1 Answers  


How to count a sum, when the numbers are read from stdin and stored into a structure?

1 Answers  






void main() { int i=5; printf("%d",i++ + ++i); }

3 Answers  


why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


main() { int i=5,j=10; i=i&=j&&10; printf("%d %d",i,j); }

1 Answers  


Under linux environment can u please provide a c code for computing sum of series 1-2+3-4+5......n terms and -1+2-3+4-5...n terms..

2 Answers  


main() { clrscr(); } clrscr();

2 Answers  


Who could write how to find a prime number in dynamic array?

1 Answers  


Categories