Write a method multiple() that determines, for a pair of integers, whether the second integer is a multiple of the first. The method should take two integer arguments and return true if the second is a multiple of the first and false otherwise. [Hint: Use the remainder operator “Modulo”.] Incorporate this method into an application main() that inputs a series of pairs of integers (one pair at a time) and determines whether the second value in each pair is a multiple of the first.
def multiple(num1, num2):
return num1 % num2 == 0
number1, number2 = [int(i) for i in input().split()]
print(multiple(number1, number2))
Sample input:
15 5
Sample output
True
Comments
Leave a comment