Ask Question
27 October, 05:08

Write a Function procedure that determines whether a given Integer is divisible by 5 or not. The function should accept one argument having a data type of Integer and return True if that Integer is divisible by 5, False otherwise.

+4
Answers (1)
  1. 27 October, 08:37
    0
    bool isdivisor (int x) / / function definition

    {

    if (x%5==0) / / check Integer is divisible by 5

    {

    return true;

    }

    else

    {

    return false;

    }

    }

    Explanation:

    #include / / header file

    using namespace std; / / using namespace std;

    bool isdivisor (int num); / / prototype

    int main () / / main function

    {

    bool t; / / bool variable

    int num; / / variable declarartion

    cout<<" enter the num:";

    cin>>num; / / input number

    t=isdivisor (num); / / calling

    if (t)

    cout<<" number is divisible by 5 ";

    else

    cout<<" number is not divisible by 5";

    return 0;

    }

    bool isdivisor (int x) / / function definition

    {

    if (x%5==0)

    {

    return true;

    }

    else

    {

    return false;

    }

    }

    Output:

    enter the num:50

    number is divisible by 5

    Explanation:

    In this program we have a declared a Boolean function i. e isdivisor that accept one argument of type int.

    check if (x%5==0) it return true otherwise false.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a Function procedure that determines whether a given Integer is divisible by 5 or not. The function should accept one argument having ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers