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 or or both:
Divisible by Output
Divisible by only orange
Divisible by only black
Divisible by and purple
Not divisible by or pink
Notes:
Divisible by only means that X is divisible by but not divisible by Divisible by only means that X is divisible by but not divisible by
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
A number X is not divisible by another number if the remainder is not 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 the output is purple because is divisible by both and The program does not output orange or black because is divisible by both and
If the user enters the output is pink because is not divisible by either or
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
