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 perimeter of an isosceles triangle is 15.6m. Find the lengths of its sides, if: The base is 3m bigger than a leg ____m, ___m, _____m
what was one human activity that contributed to the spread of the bubonic plague
Dontrelle recieved 30% off when he purchased a rare book regularly priced at $96.50.How much did Dontrelle pay?
Name five skills that are important in scientific thinking
simplify 1/3(9x-15)-2x
what is 1/9 as a decimal
what is the equation of the axis of symmetry of [tex] y = - 2{x}^{2} - 5x + 3 [/tex]and the coordinates for the vertex, find the y- intercept, find the zeros t
Read the excerpt from Roosevelt's Executive Order No. 9066. I hereby authorize and direct the Secretary of War . . . whenever he or any designated Commander de
What claim did Thorne make? What evidence supported his claim? Mungo Lady and Mungo Man
Can someone help me with this