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

Which two headings provide an opportunity for further research? [] Deepest Point Surveyed [] Rock Formation [] Elevations [] Large Lakes [] National Significanc
the particle picture is best described as....a) a gas mixtureb) a gasc) a liquidd) a liquid mixturee) a solid​
Tom plants 3 seeds. The probability that a seed will germinate is 4/5. A) Calculate the probability that all 3 seeds will germinate. B) Calculate the probabilit
URGENT HELP NEEDED! PLEASE ANSWER WITH EXPLANATION* Much appreciated 1) An 85.0 g sample of copper is initially at 22.2 ∘C What is the final temperature if th
A square has side length (5x-3) cm. What is the area of the square?​
please help 2 questions
Forty-six percent of people believe that there is life on other planets in the universe. A scientist does not agree with this finding. He surveyed 120 randomly
Find the area of the figure. A rectangle with length 3 1/4 ft and width 2 1/2 ft The area equals ____ ft2.
Solve this equation: 9x + 3 = 2(x - 4) - 3(2x + 5)
Whoever helps me gets a brainlist