निम्नलिखित छद्म कोड का आउटपुट क्या होगा?
What will be the output of the following pseudo-code ?
Integer a
Set a = 4
Do
print a + 2
a = a- 1
while (a not equals 0)
end while A
6 6 6 6
B
6 5 4 3
C
6 7 8 9
D
6 8 10 12
Explanation
Sure!
- The loop starts with
a = 4and printsa + 2. - In each iteration,
adecreases by 1 untilareaches 0. - The printed values are:
6 (4 + 2),5 (3 + 2),4 (2 + 2), and3 (1 + 2).
Answer: (B) 6 5 4 3.
Correct Answer: B) 6 5 4 3