Write a Ruby program to check three given integers and return true if one of them is 20 or more less than one of the others.
def check_num(a, b, c) return ((a - b).abs >= 20 || (b - c).abs >= 20 || (c - a).abs >= 20) end print check_num(9, 12, 22),"\n" print check_num(112, 202, 20),"\n" print check_num(102, 203, 405)
Output:
false true true
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.
Output: