Write a code using Ruby ​:

User Generated

obxunzf5

Programming

Description

Write a code using Ruby :

Create a program which generates a random number (1 - 100) by looking into rubydoc.org and using that rondom number, find if the number is lucky number(77).if you get a lucky number, then print that you are winner if not, try again.

User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

Explanation & Answer

Thank you for the opportunity to help you with your question!

x=rand(0..100)

if x==77

puts "you are winner"

else

puts "try again"

Please let me know if you need any clarification. I'm always happy to answer your questions.


Anonymous
I was having a hard time with this subject, and this was a great help.

Studypool
4.7
Trustpilot
4.5
Sitejabber
4.4

Similar Content

Related Tags