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

Write the following ratio using two other notations. 8:9
what is schlesinger worried about in this passage?
What is the volume of the cone to the nearest cubic millimeter? (Use ​π = 3.14) A) 46 mm3 B) 128 mm3 C) 183 mm3 D) 257 mm3
Que es un amigo real???..
help please thank you
How does the use of Rhythm affect the meaning of "Pears" and "Hunger"?
Which one is the correct answer
Is reading the Bible worth it?​
solve fot z show all your work. 7z - 18 =2z+ 18​
Write a hook relating to love being painful. And a hook for friendship is loyalty.