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

Clue: It is the process of breaking down sugars from food to produce energy.​
How do you drink water Pls help
which disipline involves creating computer networks
uh could i get a little help please im very confused
What is the solution to this equation? m/4 + 3 = -1
Configure password settings so that the user must: ________________ a. Cycle through 10 passwords before reusing an old one. b. Change the password every 90 da
round 0.0851 to the nearest whole number
a Restaurant that specializes in making pancakes makes 1 batch of pancakes using a ratio of 2cups of flour to 3 cups of milk. on a busy Saturday the restaurant
Select the correct answer. Function h is a transformation of the parent exponential function, f(t) = 2*. h() = -3.25 Which statement is true? O A. Function his
help me please Select the nonstandard word and change it to standard English: Mary did good on her test.​