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 was the primary purpose of the Estates General summoned by France in 1789? A) Increase the influence of peasants. b) Raise taxes to pay off a growing debt.
Cos of 16/34 Sin 32/40 Tan 32/24
Mel randomly selects a coin 150 times selecting a dime 30 times, the experimental probability is 1/5 what is the theoretical probability?
The area of the floor of a cubical room is 49[tex] {m}^{2} [/tex]Find the area of 4 walls​
how do u answer a question
Please help me plssssss
Opposite of cellular respiration
Given the rhombus ABCD, find the area. Show all the work
202.oQUESTION 2 (ENZYME ACTIVITY]The investigation was carried out to determine the effect of a detergent containing fat-digesting enzymes on a fat stain.The pr
36 Critically discuss TWO emotional / personal benefits that will motivate you to finda job​