What will be the output of the following pseudo code? Integer a=5, b=4, c=3 a…
2025
What will be the output of the following pseudo code?
Integer a=5, b=4, c=3
a = b + c
c = a – b
c = c + a
c = b + c
b = b + c
Print a, b, c
Answer: D. 7 18 14 — Correct answer: 7, 18, 14 Explanation: Start with the initial values Initial state: a = 5, b = 4, c = 3. a = b + c => a = 4 + 3 = 7 (state: a=7, b=4, c=3) c =…
- A.
7 14 7
- B.
7 14 10
- C.
7 8 14
- D.
7 18 14
Attempted by 175 students.
Show answer & explanation
Correct answer: D
Correct answer: 7, 18, 14
Explanation: Start with the initial values
Initial state: a = 5, b = 4, c = 3.
a = b + c => a = 4 + 3 = 7 (state: a=7, b=4, c=3)
c = a - b => c = 7 - 4 = 3 (state: a=7, b=4, c=3)
c = c + a => c = 3 + 7 = 10 (state: a=7, b=4, c=10)
c = b + c => c = 4 + 10 = 14 (state: a=7, b=4, c=14)
b = b + c => b = 4 + 14 = 18 (state: a=7, b=18, c=14)
Therefore, Print a, b, c => 7 18 14.