Write a Ruby program to check two non-negative integer values and return true if they have the same last digit.
def sum(a,b) sum = a + b; if(sum >= 20 && sum <= 30) return 20; end return sum; end print sum(9, 7),"\n" print sum(12, 10),"\n" print sum(22, 15)
Output:
16 20 37
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