Write the definition of a function isMultipleOf, that receives two integer arguments and returns true if the first argument is a multiple of the second. Otherwise false is returned.

Write the definition of a function isMultipleOf, that receives two integer arguments and returns true if the first argument is a multiple of the second. Otherwise false is returned.

LANGUAGE: C++

CHALLENGE:

Write the definition of a function isMultipleOf, that receives two integer arguments and returns true if the first argument is a multiple of the second. Otherwise false is returned.

So, if the arguments are 27 and 8 the function returns false because 27 is not a multiple of 8. But if the arguments are 34 and 17 the function returns true because 34 is a multiple of 17 (2*17 is 34).

SOLUTION:

bool isMultipleOf(int x, int y){
    return x%y==0;
}

Add comment