Ask Question

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. 21 April, 16:32
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers