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

6. A kid’s pool is cylindrical and has a radius of 5 feet and a height of 2 feet. If a cubic foot holds about 7.48 gallons of water, how many gallons of water d
What is the value of x for 7x - 12 y = 180 / 7x = 84
When psychologists discuss healthy ways to resolve conflict, they often include being able to take in the other person's perspective and not use power or domina
help pls i will mark brainliest
What national park is located in west virginia?​
Describe an activity that requires muscular endurance and compare it to an activity requiring muscular strength. In four to six sentences.
Solve 9x + 18 = 6y - 3x for y​
What important historical document was Thomas Jefferson the author of ?
A group of hikers starts at an elevation of 2.53 kilometers. When they stop for lunch, their elevation has increased by 1.24 kilometers. When they stop to camp
During the Cuban Missile Crisis, the US had discovered Soviet nuclear missiles in Cuba. The Americans responded by...