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 compound inequality x > −3 and x < 3 from “and” to “or” change the solution set? explain.
NEED HELP QUICK PLZ! 51 Points!
If A and B are mutually exclusive events, with P(A) = 0.19 and P(B) = 0.27, what is P(A or B)?
Need help with circle measurements in Geometry.
When people use plastic combs on their hair the comb s become negativly charged?
Why did the Protestant Reformation break the sovereighnity of the church?
Which paragraph lets you know that this story about the harvest keeper did not happen recently
Translate to an algebraic expression 49 increased by d what translation is
A 6-year-old child ate a peanut butter sandwich at snack time in school. five minutes later, her throat became swollen and she collapsed. this allergic reaction
What is the difference between temperature and heat?