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 are the coefficients of the terms? 5 9 t+8t -t
The French and Indian War led to discontent in the colonies in all of the following ways EXCEPT: Question 3 options: a) it caused the British to raise taxes in
What is one way to appeal to pathos ??A. By choosing language that has powerful rhythms B. By including examples that are supported by solid sources C. By drawi
What are the places that shape who you are?​
How does a wildfire start?​
Which fraction is equal to 0.45 REPEATING? A.5/11 B.41/99 C.41/90 D.41/9
35. A line graph uses_ on the x-axis a. categories b. time C. dependent variable d. control group
Given the function f(x) = 4x², which formula represents a formula that is shifted up by 3
Add 5/24 + 7/24 Simplify your answer.
(NEED HELP PLS ANSWER GIVING 100 POINTS) Following my question of "If a student didn't turn an assignment in on the 27th of august, and the teacher deducted 10