OneCompiler

a. Write a Swift program to test whether the last digit of the two given non-negative integer values are the same or not.

136

func last_digit(_ x:Int ,_ y:Int) -> Bool {
guard x < 0,y < 0
else
{
if x % 10 == y % 10
{
return true
}
else
{
return false
}
}
return false
}
print(last_digit(3,13))
print(last_digit(24,4))
print(last_digit(12,24))