Write a Ruby program to check two temperatures and return true if one is less than 0 and the other is greater than 100.
def temp(temp1, temp2) return ( temp1 < 0 && temp2 > 100 ) || ( temp1 > 100 && temp2 < 0 ); end print temp(110, -1),"\n" print temp(-1, 110),"\n" print temp(2, 120)
Output:
true true 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