A

Admin • 833K Points
Coach

Q. What will be the output of the given code?

Code:
for i in 1...3
for j in 1..3
puts j
end
end
  • (A) 1 2 1 2
  • (B) 0 1 2 0 1 2
  • (C) 1 2 3 1 2 3
  • (D) 1 2 3 1 2
  • Correct Answer - Option(C)
  • Views: 25
  • Filed under category Ruby
  • Hashtags:

Explanation by: Admin

The program will print 1 2 3 two times.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.