Bird
0
0

Which of the following is the correct way to print text in C?

easy📝 Syntax Q12 of 15
C - Input and Output
Which of the following is the correct way to print text in C?
Aecho "Hello, world!";
Bprintf("Hello, world!\n");
Cprint("Hello, world!\n");
Dcout << "Hello, world!";
Step-by-Step Solution
Solution:
  1. Step 1: Identify the standard output function in C

    The function to print text in C is printf(), which uses format strings.
  2. Step 2: Check the syntax correctness

    printf("Hello, world!\n"); uses printf with correct syntax and escape for newline \n.
  3. Final Answer:

    printf("Hello, world!\n"); -> Option B
  4. Quick Check:

    Use printf() to print text in C [OK]
Quick Trick: Use printf() for output in C [OK]
Common Mistakes:
  • Using print() instead of printf()
  • Using syntax from other languages like cout or echo
  • Missing semicolon at the end

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes