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

answer please ir Need help
Locke’s belief in the social contract between a government and its people meant thatLocke’s belief in the social contract between a government and its people me
which civilization built pyramids and mummified their rulers
What behavioural adaptation does a desert fox have to help it survive in hot places
what is the term for a non-citizen that is legally visting the country?
The male elephant at the city zoo weights 8,000 pounds, which is the same as 4 tons. The female elephant weights 7,000 pounds. How many does she weight?
Island controlled by the republic of China
define freedom of religion
1. Determine the magnitude of the resultant force acting on the plate and its direction, measured counter-clockwise from the positive x axis. F1 = 900 N F2 = 7
describe the relationship between rational numbers and ratios