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

please help me with this question thanks
how did the role technology play in the construction of the erie canal and empire building
help with this question it's really hard
Study the animal in the image below. What can you infer about the animal from this image?
So I have 1/2 and I have to equal it to 5, but it has to be 1/2 to the power of something to equal 5.
Fill in the blank: in space, astronauts experience ________ which is the apparent loss of weight of an object that is falling in gravitational field.
Determine the intercepts of the line that correspond to the following table of values. x | y -24 -2 -15 -8 -6 -14 y=? x=?
what is the product of 8 and -4x^2
Which describes the type of bond formed when a Group 1 element bonds with an element from Group 17? A. The group 1 element transfers an electron from its ou
which of the following is not true of water? a) it has cohesive properties b) it is polar c) it's evaporation helps regulate body temperature. d) it is a rel