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

C++ 7) Write a function Named Divisors with four integer arguments. The function

ID: 3838661 • Letter: C

Question

C++ 7) Write a function Named Divisors with four integer arguments. The function will return an integer based on the following conditions: If the first argument is a multiple of the second, the value is 1. If the first argument is a multiple of the third argument, the value is 10. If the first argument is a multiple of the fourth, the value is 100. If the first argument is a multiple of more than one of the other arguments, add the corresponding return values together. If the first argument is not a multiple of any other argument, return 0. (10 points)

Explanation / Answer

Here is the code . Please rate the answer if it helped . Thank you very much.

int Divisors(int a, int b, int c, int d)
{
int ret=0;
if( a % b == 0)
ret += 1;
if( a % c == 0)
ret += 10;
if( a % d == 0)
ret += 100;

return ret;
}