Sail E0 Webinar
Question
Comment on the output of this C code?    int main()    {        float f1 = 0.1;        if (f1 == 0.1f)            printf("equal\n");        else            printf("not equal\n");    }
Options:
A .  equal
B .  not equal
C .  Output depends on compiler
D .  None of the mentioned
Answer: Option A


0.1f results in 0.1 to be stored in floating point representations.
Output:
$ cc pgm5.c
$ a.out
equal



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

More Questions on This Topic :


Latest Videos

Latest Test Papers