Home / C Programming / Input / Output :: Discussion

Discussion :: Input / Output

  1. To print out a and b given below, which of the following printf() statement will you use?

    #include 
    
     float a=3.14;
     double b=3.14; 

     

  2. A.

    printf("%f %lf", a, b);

    B.

    printf("%Lf %f", a, b);

    C.

    printf("%Lf %Lf", a, b);

    D.

    printf("%f %Lf", a, b);

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    To print a float value, %f is used as format specifier.

    To print a double value, %lf is used as format specifier.

    Therefore, the answer is printf("%f %lf", a, b);


Be The First To Comment