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 graphs below have the same shapes. What is the equation for the red graph?
What is the area of this trapezoid? 340 cm² 427.5 cm² 440 cm² 487.5 cm²
In the figure shown below, AC is parallel to DE with transversal BF Determine the values of x and y PLEASE SHOW WORK FOR THIS! x=_______ y=_______
Quick I need an answer to this Queston:The functions f(x)= −3/4x + 2 1/4 and g(x)= (1/2)x + 1 are shown in the graph.What are the solutions to −3/4x + 2 1/4 = (
what type of bulb is unaffected ​
Please answer all the questions txxxx
Make a note of the crafts in India at the time of colonial rule, write about their usage and trade value Please tell me what is the answer
which function has a domain​
Is it true that: If f"(c) > 0, then the slope of the tangent line to the graph of the function at x = c is positive.
least common denominator of 1[tex] \frac{1}{6} \: and \: \frac{7}{9} [/tex]​