18.1k views
5 votes
Problem 1: Red, Green or Blue? One of the truly fascinating things about the world is that it’s infinite. What do we mean by this? As an example, we could ask you how many shades of yellow there are, and you’d soon realize there are an infinite number of them. Because computers don’t have an infinite amount of storage space, they have to approximate the natural world. For colors, they most often use an additive color model comprised of (R)ed, (G)reen and (B)lue. They store these values either as a floating point number 0.0 – 1.0 (fully off to fully on), or an integer between 0 to 255. Your task is to:

User Sanan
by
4.2k points

1 Answer

4 votes

Answer:

the complete question is found in the attachment

Explanation:

pseudocode

1)start

2)Ask the user to enter value for red color in range 0-255 and store it in red_val

3)Ask the user to enter value for green color in range 0-255 and store it in green_val

4)Ask the user to enter value for blue color in range 0-255 and store it in blue_val

5) compute new range of red as red_val/255

6) compute new range of green as green_val/255

7) compute new range of blue as blue_val/255

8) display the new values for red, green and blue color

9)Stop

execution

if user input is

red:101

green:67

blue:33

computed values will be

red_val : 101/255 = 0.396

green_val : 67/255 = 0.263

blue_val : 33/255 = 0.129

Problem 1: Red, Green or Blue? One of the truly fascinating things about the world-example-1
User Kylie
by
4.3k points