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

what best describes the relationship between farmers and miners on the great plains
Complete the sentence with the word that best shows that there were too many boxes in the garage. The garage was with boxes of old junk.
Can someone pls help me
25 to 45 Write the ratio as a fraction in the simplest form.
A 100.0 mL sample of 0.10 M Sr(OH)2 is titrated with 0.10 M HCl. Determine the pH of the solution after the addition of 200.0 mL HCl.
NEED ASAP!!!Look at this set of ordered pairs: (12,7) (9, 10) (7,0) (5,3) Is this relation a function? yes no​
What two characteristics describe an ftp connection?.
how long does it take a snail to crawl 66 inches? enter your anwser in a decimal number
Consider the polynomial function q(x)=-4x^5+2x^4-3x^2+12x
Please help! 2.3: More Hanging Blocks A triangle weighs 3 grams and a circle weighs 6 grams. 1. Find the weight of a square in Hanger A and the weight of a pen