Answer:
Written in Python
rgb = []
colr = []
for i in range(0,3):
inp = int(input("Input: "))
if (inp >=0 and inp<=255):
rgb.append(inp)
else:
print("Range is 0 to 255")
exit()
colr.extend(rgb)
rgb.sort()
for i in range(0,3):
print(colr[i] - rgb[0])
Explanation:
The next two lines declares two empty lists
rgb = []
colr = []
The following iteration lets user input into rgb list
for i in range(0,3):
inp = int(input("Input: "))
if (inp >=0 and inp<=255):
rgb.append(inp)
else:
print("Range is 0 to 255")
exit()
This line copies the content of rgb to colr
colr.extend(rgb)
This line sorts list rgb
rgb.sort()
This iteration calculates and prints the difference between each individual input and the smallest of the inputs
for i in range(0,3):
print(colr[i] - rgb[0])