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

round 265,400 to the nearest ten thousands place
The difference between a number and 12 is 20
Which one is bigger 95.580 or 95.58
What is the number value after the decimal point
what does god's response to each act of creation suggest about his work? a. he wants to create other worlds. b. he is pleased with what he has made. c. he makes
write an addition equation that can help you find 9-6
Determine the 12th term of the sequence 5,15,45
how many thousands of people live in Boston?
let f(x) = x 7 and g(x) = x − 4. find f(x) ⋅ g(x). x2 − 3x − 28 x2 − 3x − 11 x2 3x − 28 x2 3x − 11
A punch recipe for 24 people uses 4 liters of Soda, 2 pints of sherbet, and 6 cups of Ice. How much of each ingredient would you need to make an identical recip