Question: Create a scratch program that asks the user to enter a number X . The program produces the following output after checking if X is

Create a scratch program that asks the user to enter a number X. The program produces the following output after checking if X is divisible by 3 or 11(or both):
Divisible by... Output
Divisible by 3 only orange
Divisible by 11 only black
Divisible by 3 and 11 purple
Not divisible by 3 or 11 pink
Notes:
Divisible by 3 only means that X is divisible by 3 but not divisible by 11. Divisible by 11 only means that X is divisible by 11 but not divisible by 3.
Recall from last week that you can use the mod block to check if one number (in this case X) is divisible by another number. Remember, the mod block returns the remainder when the number entered on the left side of the block is divided by the number entered on the right side. To determine if one number (X) is divisible by another number, we need the remainder to be 0.
A number (X) is not divisible by another number if the remainder is not 0.(Hint: How could you use a logic operator with the mod block to test if a number is not divisible by another number?)
Your program must produce only one output. For example:
If the user enters 33, the output is purple because 33 is divisible by both 3 and 11. The program does not output orange or black because 33 is divisible by both 3 and 11.
If the user enters 14, the output is pink because 14 is not divisible by either 3 or 11.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!