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

what is 5 7/10 - 5/18
What is a tool that shows the relationship between distances on a map and actual distances
I don't understand this please look at the picture. Thank You for your answer
is an empty calorie food that some people call liquid candy
why do you subtract exponents when dividing powers with the same base
solve |x|<6 a. {-6, 6} b. {x|x> -6 and x< 6} c. {x|x< -6 or x< 6}
The product of 2 and a number x is 3/4 . Which statements are true? Select each correct answer. x=−54 x+2=34 x2=34 x=32 x=38 2x=34
The Spanish verb "traer" is a "go" verb.
When cool, dense air from over the water flows inland, it's called a ____. a. land breeze c. jet stream b. polar easterly d. sea breeze
what is the starting point of all food chains/webs?