A

Admin • 828.03K Points
Coach

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

Code:
for num in 1...4

puts num*num

end
  • (A) 0 1 4 9
  • (B) 1 4 9 16
  • (C) 0 1 2 3
  • (D) 1 2 3
  • Correct Answer - Option(B)
  • Views: 9
  • Filed under category Ruby
  • Hashtags:

Explanation by: Admin
The program will print 1 4 9 16.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.