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

which decision maker tends to be instinctive rather then practical when solving problems
A student measures the volume of a liquid and finds it to be 40 mL. How many significant figures are in the measurement? A. 1 B. 2 C. 3 D. 4
can u guys show me how 58 is the right answer? i need to see where i went wrong so please include the whole process.
I don't get how to do this
what operation should be performed SECOND to solve this problem? The Johnson family can fly from Washington DC to to London for $18 per mile per person the dist
How could you prove the product of any two negative numbers is a positive number
what is midnight a. 1:00 pm b. 12:00 am c. 10:00 am d. 4:00 pm
13 please help me on it
The Ye Ol' Sandwich Shop sells 4 different sandwiches, 6 different drinks, and 3 different desserts. How many different orders could you place if you d
What is one major supreme court decision in history that you could think of?