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

is one method of measurement more accurate than the other? Why or why not?
Which type of bacteria is used to make cheese, sauerkraut and fruit juices?
In a parallelogram ABCD is given. Find the measurement of angle A.
I will mark you as the brainiest if you get this correct Thx so much xxx
Help plz!!! Will give brainliest
Which of the following best forms the figure shown?
7+15÷3⋅2−12 pls solve via orders of operations
it takes 120 drops of water to fill a teaspoon write the prime fractorization of 120 using exponents ​
1. A swimming pool has the dimensions shown below. A path three feet wide surrounds the pool. 113 feet (7x-2) feet 1 Write an expression that represents the per
An equilateral triangle with side lengths of 10 units is translated 4 units to the right. What is the length of one side of the triangle after translation, in u