61.8k views
2 votes
Write an expression that evaluates to true if the value of the integer variable numberOfPrizes is divisible (with no remainder) by the integer variable numberOfParticipants. (Assume that numberOfParticipants is not zero.)

User Bsr
by
5.4k points

1 Answer

0 votes

Answer:

numberOfPrizes%numberOfParticipants==0

Step-by-step explanation:

  • Above expression includes % sign, which means mod.
  • Mod of a value with another makes the 1st value divide by 2nd and return the remainder.
  • As numberOfParticipants cant be zero (given), the answer must be a proper number.
  • If numberOfPrizes is completely divisible by numberOfParticipants then it will return 0 as shown in above expression. True case.
  • If a digit other than 0 is a result then it will be false.
User Tamar
by
5.3k points