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

Identify the sentence with all words spelled correctly. a. Silvio and​ Lena's marrage ceremony took place on the beach. b. Javier had to renew his​ driver's lic
What happen when a cell divides?
All of the following are powers and functions assigned to the legislative branch EXCEPT: a. coin money b. declare war c. make treaties d. borrow money
A main character in a story that is a hero. A. Antagonist B. Protagonist C. Scientist D. Artist
Multiply. (–2.1) ∙ (–1.4) a. –3.5 b. –2.94 c. 2.94 d. 3.5
If someone is a “nativist,” who is he or she against?
How do you write 47300 in scientific notation
five ninths times the difference of f and 32
What was the name of the general that led the Nazi forces in the Battle of El Alamein? A. General Eisenhower B. General Rommel C. General Goebbels D. General Hi
Show the work for 2 divided by 50