In: Computer Science
C ++ program that uses a function “IsDivisibleBy5” that returns a 1 if the input integer is evenly divisible by 5. Return 0 otherwise. Also include a function “IsOdd()” that returns a 1 if the input integer is odd. Return 0 otherwise.
c++
#include <iostream>
using namespace std;
// called function
int isDivisibleBy5(int num)
{
// checks the condition number is divisible by 5 or not
if(num%5==0)
{
// return 1
return 1;
}
else
{
//return 0
return 0;
}
}
// called function
int odd(int num)
{
// checks the condition number is divisible by 3 or not
if(num%3==0)
{
// return 1
return 1;
}
else
{
// return 0
return 0;
}
}
// main function
int main()
{
// variable declaration
int num = 220;
// calling a function & passing the parameter and returned
value is printed
cout<<isDivisibleBy5(num)<<"\n";
// calling a function & passing the parameter and returned
value is printed
cout<<odd(num);
return 0;
}
output