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

New mexico denied native americans the right to vote on the grounds that a. they could not pass a literacy test. b. they were not white. c. they did not pay
find the next term of the given sequence. 1.31, 2.54, 3.77, ...
In what ways does Ismene differ from her sister, Antigone, in Antigone? She cares more about public opinion and approval than does Antigone, who always follows
Read the following poem and answer the question that follows. O Captain! my Captain! our fearful trip is done; The ship has weather'd every rack, the prize we s
how old is Washington DC
e or falsefats are found in animal products and some vegetables.
As the temperature of a liquid increases, the solubility of a liquid in that liquid A. increases. B. decreases. C. stays the same. D. either increases or decrea
Solve this problem 280-4/5q=3/5q
how does noise affects the credibility of a text?
write 6 1/4% as a decimal