Q:

Write a Ruby program to check two non-negative integer values and return true if they have the same last digit

0

Write a Ruby program to check two non-negative integer values and return true if they have the same last digit.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now