Home / C Programming / Input / Output :: Discussion

Discussion :: Input / Output

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

    #include 
     float a; 
     double b; 
    

  2. A.

    scanf("%f %f", &a, &b);

    B.

    scanf("%Lf %Lf", &a, &b);

    C.

    scanf("%f %Lf", &a, &b);

    D.

    scanf("%f %lf", &a, &b);

    View Answer

    Workspace

    Answer : Option D

    Explanation :

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

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

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


Be The First To Comment