Bird
0
0

What will be the output of this C program?

medium📝 Predict Output Q5 of 15
C - Input and Output
What will be the output of this C program?
int x, y, z;
scanf("%d %d %d", &x, &y, &z);
printf("%d", x + y + z);

Input: 2 3 4
A2 3 4
B234
C9
DError
Step-by-Step Solution
Solution:
  1. Step 1: Read three integers from input

    x=2, y=3, z=4 from input "2 3 4".
  2. Step 2: Calculate sum and print

    Sum is 2+3+4=9, printed as single integer.
  3. Final Answer:

    The output is "9". -> Option C
  4. Quick Check:

    Sum of inputs printed = 9 [OK]
Quick Trick: Sum variables before printing for combined output [OK]
Common Mistakes:
  • Printing variables without sum
  • Concatenating numbers as strings
  • Syntax errors in scanf

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes