Bird
0
0

Which of the following is the correct syntax to read an integer input in C?

easy📝 Syntax Q3 of 15
C - Input and Output
Which of the following is the correct syntax to read an integer input in C?
Aread(num);
Bprint("%d", num);
Cinput(num);
Dscanf("%d", &num);
Step-by-Step Solution
Solution:
  1. Step 1: Recall C input syntax

    In C, scanf is used to read input, with format specifiers like %d for integers.
  2. Step 2: Check each option

    Only scanf with "%d" and address operator & is correct syntax for integer input.
  3. Final Answer:

    scanf("%d", &num); -> Option D
  4. Quick Check:

    scanf + %d + &variable = input integer [OK]
Quick Trick: Use scanf with & for input variables [OK]
Common Mistakes:
  • Using print instead of scanf
  • Omitting & before variable
  • Using non-C functions like input()

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes