Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help with this question thank you could u explain some of the steps.with

ID: 3618307 • Letter: P

Question

Please help with this question thank you could u explain some of the steps.with comments// 1. 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.] Incorporate this method into an application 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.

Explanation / Answer

The easy solution to this is to use the modulus (%). It returns 0 if the first number is a multiple of the second. So your function would look like this: bool isMultiple( int original, int multiple ) { if( multiple%original == 0 ) return true; else return false; } The modulus is a lifesaver for these types of problems. Hope this helps.