Hi guys, I am fairly new to programming in general and i am taking a C++ course here at my local college. the teacher has asked us to do this
[Write an inline function bool is DivisibleBy(int m, int n). This function shall determine if m is divisible by n. Hint: The % operator fails if the right operand is 0. Make sure to handle this case appropriately]
For the life of me I cant get it right i get it to compile but it does not display nothing here is the code I have so far any help is welcome.
# include <iostream>
usingnamespace std;
inlineint divisibleBy (int m, int n)
{
if (n == 0)
{
cout << "sorry you cant divide by 0 please try again...." << endl;
returnfalse;
}
elseif (m % n == 0)
{
cout << "m is divisible by n thanks \n" << endl;
returntrue;
}
else
{
cout << "m is not divisible by n sorry try again \n" << endl;
returnfalse;
}
}
int main(int argc, char** argv)
{
cout << "Enter two numbers\n";
int m, n;
cin >> m >> n;
divisibleBy(m, n);
return 0;
}