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 is the irony of text lebanon's drinking water.​
Handwritten solution required
In the adjoining figure, prove A + B + C + D + E = 180° ​
If a quadrilateral is a parallelogram, then it’s opposite angles are ?
***URGENT*** Find the derivative of y with respect to x if 2^(xy) = 1. Show all your work.
There are 5 boys and 6 girls participating in a singing contest. What is the likelihood that a girl will win the contest?
El invierno que viene Ricardo Rojas Response area dos semanas de vacaciones. El y su familia Response area un viaje a Panama. Alli ellos podrán pasar unos dias
Section-C (A) Supply the correct form of the verbs in brackets : (i) Fortune Favors (Favour) the brave. (ii) Our school..uns. (run) from 7.30 to 12.30. (iii) He
carbon 10 has a half-life of 19.29s. if you have 1.53 kg, how long will it take until you have less than 10.0 g.
A rifle bullet with mass 8.00 g and initial horizontal velocity 280 m/s strikes and embeds itself in a block with mass 0.992 kg that rests on a frictionless sur