Q. We want to get a decimal number entered from the keyboard, which statement is correct?

  • (A) scanf("%f",decimalNumber);
  • (B) scanf("%f",&decimalNumber);
  • (C) scanf("%lf", *decimalNumber);
  • (D) scanf("%d",decimalNumber);
πŸ’¬ Discuss
βœ… Correct Answer: (B) scanf("%f",&decimalNumber);
Explanation: scanf is a function declared in the <stdio.h> header, this function can be used for capturing formatted data, whether letters, numbers or strings.

%d to print integer and %f to print float value.


Explanation by: Rudra Pratap Singh
scanf is a function declared in the <stdio.h> header, this function can be used for capturing formatted data, whether letters, numbers or strings.

%d to print integer and %f to print float value.



πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
267
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Rudra Pratap Singh
Publisher
πŸ“ˆ
86%
Success Rate