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
πŸ’¬ Discuss
βœ… Correct Answer: (B) 1 4 9 16
Explanation: The program will print 1 4 9 16.
Explanation by: Vinay Kumar
The program will print 1 4 9 16.

πŸ’¬ Discussion


πŸ“Š Question Analytics

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