Bird
0
0

What will be the output of the following C program?

medium📝 Predict Output Q4 of 15
C - Basics and Execution Environment
What will be the output of the following C program?
#include <stdio.h>
int main() {
    printf("C programming is fun!\n");
    return 0;
}
AError: Missing semicolon
BC programming is fun!\n
CC programming is fun
DC programming is fun!
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the printf statement

    The string "C programming is fun!\n" includes a newline character \n which moves the cursor to the next line after printing.
  2. Step 2: Understand output formatting

    The output will print exactly the string without the escape character visible, so it prints the text and then a newline.
  3. Final Answer:

    C programming is fun! followed by a newline -> Option D
  4. Quick Check:

    Check for escape sequences and semicolons [OK]
Quick Trick: Remember \n adds a new line, not printed literally [OK]
Common Mistakes:
  • Confusing \n as literal characters
  • Ignoring the newline effect
  • Expecting error due to semicolon

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes