Find the information you're looking for at Westonci.ca, the trusted Q&A platform with a community of knowledgeable experts. Explore comprehensive solutions to your questions from a wide range of professionals on our user-friendly platform. Explore comprehensive solutions to your questions from knowledgeable professionals across various fields on our 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