Ask Question
2 June, 02:41

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

+1
Answers (1)
  1. 2 June, 04:53
    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?
Get 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 & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers