Q:

Write a Ruby program to test whether you are minor (Consider a child unless he or she is less than 18 years old.) or not

0

 Write a Ruby program to test whether you are minor (Consider a child unless he or she is less than 18 years old.) or not.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Ruby Code:

print "Input your age: "
age = gets.to_i
puts "You are a minor" unless age >= 18

Output:

Input your age: You are a minor.

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now