1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
PSYCHO15rus [73]
3 years ago
3

I need to know how to input this into python on zybooks. I've been stuck on this for days and I keep running into "invalid synta

x" or "unknown word red" Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is 130 50 130, the output is: 80 0 80 Find the smallest value, and then subtract it from all three values, thus removing the gray.

Computers and Technology
1 answer:
pychu [463]3 years ago
7 0

Answer:

Here is the C++ program:  

#include <iostream>   //to use input output functions  

using namespace std;   //to identify objects cin cout  

int main() {   //start of main method  

int red,green,blue,smallest;   //declare variables to store integer values of red,green, blue and to store the smallest value  

cout<<"Enter value for red: ";  //prompts user to enter value for red  

cin>>red;  //reads value for red from user  

cout<<"Enter value for green: ";  //prompts user to enter value for green  

cin>>green;  //reads value for green from user  

cout<<"Enter value for blue: "; //prompts user to enter value for blue  

cin>>blue;   //reads value for blue from user  

//computes the smallest value

if(red<green && red<blue) //if red value is less than green and blue values  

smallest=red;   //red is the smallest so assign value of red to smallest  

else if(green<blue)   //if green value is less than blue value  

smallest=green;   //green is the smallest so assign value of green to smallest  

else  //this means blue is the smallest  

smallest=blue;  //assign value of blue to smallest  

//removes gray part by subtracting smallest from rgb  

red=red-smallest;  //subtract smallest from red  

green=green-smallest;  //subtract smallest from green  

blue=blue-smallest;  //subtract smallest from blue  

cout<<"red after removing gray part: "<<red<<endl;  //displays amount of red after removing gray  

cout<<"green after removing gray part: "<<green<<endl;  //displays amount of green after removing gray

cout<<"blue after removing gray part: "<<blue<<endl;  } //displays amount of blue after removing gray  

Explanation:

I will explain the program using an example.  

Lets say user enter 130 as value for red, 50 for green and 130 for blue. So

red = 130  

green = 50  

blue = 130  

First if condition if(red<green && red<blue)   checks if value of red is less than green and blue. Since red=130 so this condition evaluate to false and the program moves to the else if part else if(green<blue) which checks if green is less than blue. This condition evaluates to true as green=50 and blue = 130 so green is less than blue. Hence the body of this else if executes which has the statement: smallest=green;  so the smallest it set to green value.  

smallest = 50  

Now the statement: red=red-smallest; becomes:  

red = 130 - 50  

red = 80  

the statement: green=green-smallest;  becomes:  

green = 50 - 50  

green = 0  

the statement: blue=blue-smallest; becomes:  

blue = 130 - 50  

blue = 80  

So the output of the entire program is:  

red after removing gray part: 80                                                                                                 green after removing gray part: 0                                                                                                blue after removing gray part: 80  

The screenshot of the program along with its output is attached.

You might be interested in
Conceptual note-taking is the act of writing down information in the order it is given. drawing attention to details with a mark
Dvinal [7]

Answer:A

Explanation:Conceptual notetaking is the act of writing down information in the order it is given.

4 0
3 years ago
Read 2 more answers
In her presentation, Emily has inserted two tables in a slide and formatted the text on all slides. Which feature of the present
Nitella [24]
Insert table and change text
 
5 0
3 years ago
Which of the following explains why computers can be used in accounts payable? Computers can use random steps to identify the du
Sphinxa [80]

Answer:

Its A buddy

Explanation:

that what it was on ingenuity

4 0
3 years ago
Read 2 more answers
Name and define (or list the set that defines) three of the four common data types in programming.
Dominik [7]

Answer: this is the  Answer your question

6 0
3 years ago
During the troubleshooting of a pc that will not boot, it is suspected that the problem is with the ram modules. the ram modules
Damm [24]
The modules were somehow disconnected
8 0
4 years ago
Other questions:
  • Lisa adds her co-worker Renald to a meeting and removes her secretary Olivia from the meeting. What will happen as a result?
    14·2 answers
  • 14. Which commercial RDBMS product was the first to hit the market and is the biggest?
    15·1 answer
  • Which is the correct process for selecting an entire row in a spreadsheet?
    15·2 answers
  • How is it possible to find encyclopedias and reference texts on the internet
    11·2 answers
  • Define data, explain its three forms, and the general steps a computer performs related to data.
    7·1 answer
  • Design by contract considers the software system to be a setof:
    10·1 answer
  • What is a spark line? how is a different a chart​
    14·1 answer
  • Use the function random.randint to write a program that rolls a 6-sided die 100 times, and prints out all of the rolls.
    8·1 answer
  • Your manager has asked you to write a program that displays the percentage of males and female in your class. The program should
    7·1 answer
  • (blank) is an expansion card that enables a computer to connect to a network:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!