Divisors and Multiples
InterviewTime limit1sMemory limit128 MB
For each pair of numbers, print factor if the first divides the second, multiple if the first is a multiple of the second, or neither.
- Level
Easy1 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
We have .
From this equation we can observe the following facts.
- is a divisor of , and is a multiple of .
- is a divisor of , and is a multiple of .
Given two numbers, write a program that determines which of the following three relationships holds between the first number and the second number.
- The first number is a divisor of the second number.
- The first number is a multiple of the second number.
- The first number is neither a divisor nor a multiple of the second number.
Input
The input consists of several test cases. Each test case is given on one line as two natural numbers, each not exceeding . The two numbers are never equal. The last line of the input contains two zeros, and this line is not processed.
Output
For each test case, print factor if the first number is a divisor of the second number, multiple if the first number is a multiple of the second number, or neither if it is neither, each on its own line.