Write a Ruby program to find the greatest of three numbers.
Ruby Code:
x,y,z = 2,5,4 if x >= y and x >= z puts "x = #{x} is greatest." elsif y >= z and y >= x puts "y = #{y} is greatest." else puts "z = #{z} is greatest." end
Output:
y = 5 is greatest.
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Ruby Code:
Output:
need an explanation for this answer? contact us directly to get an explanation for this answer