LearnFrenzy
Sign in Take a free test

C Input / Output · Input/Output MCQ · Question 2

Which specifier reads a double with scanf()? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

Which conversion reads a value into a double variable with scanf()?

  • A %f
  • B %lf Correct
  • C %d
  • D %Lf
Correct Answer: Option B

scanf receives a pointer, so it must know the exact type: %f for float *, %lf for double *, %Lf for long double *. printf uses %f for both float and double because float arguments are promoted.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links