dorisspears45831 dorisspears45831
  • 02-09-2019
  • Computers and Technology
contestada

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

Respuesta :

asadashraf7788
asadashraf7788 asadashraf7788
  • 05-09-2019

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

}

Answer Link

Otras preguntas

The Assyrian culture is best known for which of the following traits? They were nomadic.They were militaristic.They were agricultural.They were democratic.
What was the greatest challenge cities faced as a result of rapid industrialization in the 1800s?
Eric's notebook has 30 pages he wants to write a number on each page how many digits will he right when he numbers all the pages in the notebook
Suppose X and Y represent two different school populations where X > Y and X and Y must be greater than 0. Which of the following expressions is the largest?
how does using iodize salt help in preventing thyroid problem?
When the force on an object increases, so does its __________. A. acceleration B. velocity C. mass D. inertia
12 is what percent of 4,000
$11.20 is 30% of what number???
What is -24 feet per 2 seconds as a unit rate in feet per seconds
Which word group best completes the sentence without introducing an inappropriate shift in tense? After the storm blew the pecans to the ground, A. we have