2.1 Check if a number is a divisor of another number

Python solution

View solution

This is just one of many possible solutions:

number1 = int(input())
number2 = int(input())
if number1 % number2 == 0:
  print(str(number2) + ' is a divisor of the number ' + str(number1) + '.')
else:
  print(str(number2) + ' is not a divisor of the number ' + str(number1) + '.')

Back to programming challenge