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

Write a C program to print ‘Campus Force training’ without using even a single semicolon in the program.

3 Answers   Wipro,


write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


Finding a number multiplication of 8 with out using arithmetic operator

8 Answers   Eyeball, NetApp,


Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.

2 Answers   Wipro,


Is the following code legal? typedef struct a aType; struct a { int x; aType *b; };

1 Answers  






write a c program to Create a mail account by taking the username, password, confirm password, secret_question, secret_answer and phone number. Allow users to register, login and reset password(based on secret question). Display the user accounts and their details .

2 Answers  


write a c program to print magic square of order n when n>3 and n is odd?

1 Answers   HCL,


Give a oneline C expression to test whether a number is a power of 2?

25 Answers   EA Electronic Arts, Google, Motorola,


int aaa() {printf(“Hi”);} int bbb(){printf(“hello”);} iny ccc(){printf(“bye”);} main() { int ( * ptr[3]) (); ptr[0] = aaa; ptr[1] = bbb; ptr[2] =ccc; ptr[2](); }

1 Answers  


#define max 5 #define int arr1[max] main() { typedef char arr2[max]; arr1 list={0,1,2,3,4}; arr2 name="name"; printf("%d %s",list[0],name); }

1 Answers  


How can you relate the function with the structure? Explain with an appropriate example.

0 Answers  


main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }

1 Answers  


Categories