Bird
0
0

What is the output of this C program?

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

Input:
3 7
A10 10 20
B3 7 10
C7 3 10
D3 7 37
Step-by-Step Solution
Solution:
  1. Step 1: Read input values

    scanf reads 3 into x and 7 into y.
  2. Step 2: Calculate and print output

    printf prints x (3), y (7), and x + y (3 + 7 = 10).
  3. Final Answer:

    3 7 10 -> Option B
  4. Quick Check:

    3 + 7 = 10 [OK]
Quick Trick: Add variables inside printf for combined output [OK]
Common Mistakes:
  • Mixing order of variables in printf
  • Confusing concatenation with addition
  • Not using & in scanf

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More C Quizzes