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

does atacama border the pacific ocean
john scopes , the defendant in the 1925 scopes trail , was
what is the difference between an organ and an organalle
como chamamos a américa na divisão cultural ?
The concept of less eligibility was introduced in 1834 to
I need information about rice farmers in edo Japan period plz help like anything would be good
what times what equals 7 but adds to -20
Janis divided the two polynomials shown: 4x+2(4x^2-10x-6) What is the quotient? A: x+3 B: x-3 C: x-2 + -2/4x+2 D: x-2+-10/4x+2
Which is the best strategy for avoiding long-term stress?
what is the purpose of the enclosed seeds in fruit found on a flowering plant