Home / CSE MCQs / C-MCQs :: Discussion

Discussion :: C-MCQs

  1. 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");
        }
  2. A.
    equal
    B.
    not equal
    C.
    Output depends on compiler
    D.
    None of the mentioned

    View Answer

    Workspace

    Answer : Option A

    Explanation :

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


Be The First To Comment