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 feature distinguishes a neutral atom from an ion
what is the linking verb in the sentence? my aunt seems comfortable as the leader of the dance. a. comfortable b. seems c. aunt d. dance
How did radio shape modernism in the 1920s?
¿Alguien sabe donde puedo descargar estos libros? ¡urgen! -Tecnología 2 de la editorial larousse -Complemento matemático 2 Los dos son de secundaria
Solve the inequality –24 ≤ x – 3 – 8x.
Can you change 6% into decimal?
can Someone Please Help Me With This Answer
What are the two main types of scientific inquiry? Give an example of each
what is the domain of the step function f(x) = ⌈2x⌉ – 1? {x| x ≥ –1} {x| x ≥ 1} {x| x is an integer} {x| x is a real number}
define a cardiovascular disease.