Monday, June 18, 2012

Homework 5: Divisibility

1. 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.)

numberOfPrizes % numberOfParticipants == 0

2.  Write an expression that evaluates to true if the value of the integer variable  widthOfBox is not evenly divisible by the integer variable  widthOfBook . (Assume that  widthOfBook is not zero. Note: evenly divisible means divisible without a non-zero remainder.)

widthOfBox % widthOfBook != 0

No comments:

Post a Comment