Answer:
- r = int(input("Enter a number for red channel: "))
- g = int(input("Enter a number for green channel: "))
- b = int(input("Enter a number for blue channel: "))
-
- if(r < 0 or r >255):
- print("Red number is not correct.")
-
- if(g < 0 or g >255):
- print("Green number is not correct.")
-
- if(b < 0 or b >255):
- print("Blue number is not correct.")
Step-by-step explanation:
The solution code is written in Python.
Firstly, prompt user to input three numbers for red, green and blue (Line 1-3).
Next, create three similar if statements to check if the red, green and blue are within the range 0-255 by using logical operator "or" to check if the number is smaller than 0 or bigger than 255. If either one condition is met, display a message to indicate a particular color number is not correct (Line 5-12).