Ask Question

Write a method isMultiple 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 1 if the second is a multiple of the first and 0 otherwise.

+2
Answers (1)
  1. 26 January, 11:33
    0
    I don't know what language you want it in but I will write this in Java.

    public int isMultiple (int x, int y) {

    if (x % y = = 0)

    return 1;

    return 0;

    }

    The mod function (%) returns 0 iff x divides y.

    Feel free to ask me questions!
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a method isMultiple that determines, for a pair of integers, whether the second integer is a multiple of the first. The method should ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers