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

You use 4 gallons of water on 30 plants in your garden. At that rate, how much water will it take to water 45 plants?
True or faults your somatotype is primarily determined by the genes inherited from your parents
In the context of barriers to international communication, _____ refers to the number of other messages competing for a potential consumer's attention
Aria has been awake for two nights in a row and still feels highly energetic, and euphoric. the previous day, she quit her job on an impulse and decided to beco
The answer to all of these questions
What is the inverse of the function f(x) =1\9 x + 2? h(x) = 18x – 2 h(x) = 9x – 18 h(x) = 9x + 18 h(x) = 18x + 2
What significance did mansa musa likely attach to his pilgrimage? how might egyptians, arabs, and european have viewed it?
! Why is history important in writing?
What observations does Tom Paine make about general Washington
Which describes why other peoples most likely moved into Bantu territory?