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

When constructing an inscribed polygon with a compass and straightedge, how should you start the construction? Use a protractor to measure the original circle i
Which activity is an example of poor personal hygiene
mi primo y yo conocemos a los jugadores del real madrid. ellos __________.
s the underlined word a direct object or an indirect object? bring yourself an apple to eat. underlined word: yourself a. direct object b. indirect object
what's five decimal 55 as a fraction
what is the value of the expression when b = 3? 4b to the 4 power
Definition of climate change
what is the difference between earthly and godly things
how many variable terms are in the expression 3x3y 5xz − 4y x − z 9?
how tall is 1000 pennies in centimers