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

Find the interest: $3650 at 2% for 1 year
F(x)=5x-1 F(x)=5x F(x)=x-5 F(x)=5x+1
in the system you created in (a), give an example of a sudden change that would affect the stability of the system. Explain what may happen.
PLEASE HELP!!! Which Expression defines the arithmetic series 3 + 7 + 11 + . . . for eight terms?
What was significant about the Renaissance? A) It marked the beginning of artistic expression in Europe. B) It represented a time of challenging traditional
Which best describes a major problem faced by the Niagara movement
What do they show about life in Hoovervilles across the country?
What was the greatest discovery by galileo during his inclined-plane experiments?
What member of the museum staff works on a voluntary basis and can provide guided tours?
distance between parallel lines y=3x+10 and y=3x-20