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 following sentence lacks necessary commas, semicolons, and colons. Choose the answer that demonstrates correct separation of the elements in a series. Barba
Find the greatest common factor of 21 and 49 .
atomic mass is determined by the number of protons plus the number of
why does tap water or pool water typically test positive for the presence of chlorine
Over-the-counter weight loss supplements typically contain A. antidepressants. B. diuretics. C. vitamins. D. minerals.
Can someone help me . Thanks . Work is due tomorrow
125% of 62 is what number
Dark spots on the photosphere are known as A. the corona. B. the chromosphere. C. sunspots. D. solar wind.
graph each function over a one-period interval. y= -2 sec1/2x
What Supreme Court case did George W. Bush support the reversal of? A. Brown v. the Board of Education B. Miranda v. Arizona C. Bush v. Gore D. Roe v. Wade