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

1. Assuming that you expect five heads and five tails in ten tosses, how do the results of your tosses compare? How about the results of your partner’s tosses?
Indices, appendices and title pages are all text aids. True or False
One hundred percent of cool kids agree,Sugar pop cereal is the best way to begin your day!Which fallacy is used in this statement? A.overgenenraliztion B.Bandwa
Please select the word from the list that best fits the definition a large farming estate A. Julius Ceasar B.triumvirate C. Cicero D. latifundia E. Actium E.
A town’s population went from 25,800 to 42,600 in 15 years. What was the percent of change? 61% 39.4% 35% 65.1%
The goal of the 19th amendment
HELP WITH MATH!!!!!!!!!!!!
What do solid and hazardous wastes have in common?
Edith wants to make a paperweight at pottery class. She wants the paperweight to have a pyramid-like shape with a base area of 120 square centimeters, and she w
Nothing at all nothing