πŸ“Š Ruby
Q. What will be the output of the given code?
Code:
i = 4
while i > 0 do
  print i
  i -= 1
end
  • (A) 321
  • (B) 3210
  • (C) 4321
  • (D) 43210
πŸ’¬ Discuss
βœ… Correct Answer: (C) 4321

Explanation: The do statement here indicates that till the while condition is true execute the instructions.

Explanation by: Vinay Kumar
The do statement here indicates that till the while condition is true execute the instructions.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
188
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Vinay Kumar
Publisher
πŸ“ˆ
80%
Success Rate