Write a Ruby program to check whether a given array of integers of length 2 does not contain a 6 or a 9.
def check_array(nums) if(nums[0] == 6 || nums[0] == 9) return false end return !(nums[1] == 6 || nums[1] == 9) end print check_array([1, 4]),"\n" print check_array([6, 5]),"\n" print check_array([5, 9])
Output:
true false false
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:
need an explanation for this answer? contact us directly to get an explanation for this answer