Westonci.ca is your trusted source for accurate answers to all your questions. Join our community and start learning today! Our platform provides a seamless experience for finding precise answers from a network of experienced professionals. Discover in-depth answers to your questions from a wide network of professionals on our user-friendly Q&A platform.

Write an expression that evaluates to true if the value of the int variable widthOfBox is not divisible by the value of the int variable widthOfBook. Assume that widthOfBook is not zero. ("Not divisible" means has a remainder.)

Sagot :

Answer:

The expression is:

if widthOfBox % widthOfBook != 0

Explanation:

Given

Variables:

(1) widthOfBox and

(2) widthOfBook

Required

Statement that checks if (1) is divisible by (2)

To do this, we make use of the modulo operator. This checks if (1) is divisible by 2

If the result of the operation is 0, then (1) can be divided by (2)

Else, (1) can not be divided by (2)

From the question, we need the statement to be true if the numbers are not divisible.

So, we make use of the not equal to operator alongside the modulo operator