Ask Question
7 August, 16:06

Return true if the given non-negative number is a multiple of 3 or 5, but not both. Use the % "mod" operator.

+4
Answers (1)
  1. 7 August, 17:28
    0
    the following C+ + function will return true if the given non - negative number is multiple of 5 or 3 else it will return false.

    bool function (int x) {

    / / variable to check if it is multiple of both or not

    int number = 0;

    if (3%x = = 0) {

    number++;

    }

    if (5%x = = 0) {

    number++;

    }

    / / Now returning by deciding

    if (number <=1)

    return true;

    else

    return false

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Return true if the given non-negative number is a multiple of 3 or 5, but not both. Use the % "mod" operator. ...” 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