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
aleksandr82 [10.1K]
3 years ago
13

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

Required:
Find the smallest value, and then subtract it from all three values, thus removing the gray.
Computers and Technology
1 answer:
Effectus [21]3 years ago
8 0

Answer:

<em>The programming language is not stated; However, I'll answer the question using C++ programming language, </em>

<em>This program uses comments for explanations  </em>

<em>Program starts here</em>

#include<iostream>

using namespace std;

int main()

{

//Declare Array

int colorcode[3],graycode[3];

//Prompt user for color code

cout<<"Enter Color Code (One on a line)"<<endl<<"Inout Range is 0 to 255"<<endl;

for(int i = 0;i<3;i++)

{

 ccode:  

 cout<<"Enter Color Code "<<i+1<<": ";

 cin>>colorcode[i];

 if(colorcode[i]<0 || colorcode[i]>255)

 {

  cout<<"Input Range is 0 to 255"<<'\n';

  goto ccode;

 }

}

//Initialize smallest to colorcode[0]

int smallest = colorcode[0];

//Determine smallest

for(int i = 0;i<3;i++)

{

 if(colorcode[i]<smallest)

 {

  smallest = colorcode[i];

 }

}

//Determine Graycode

for(int i = 0;i<3;i++)

{

 graycode[i] = colorcode[i] - smallest;

}

//Display Result:

cout<<"Color Code: "<<"(";

for(int i = 0;i<3;i++)

{

 if(i!=2)

 {

 cout<<colorcode[i]<<",";  

 }

 else

 {

  cout<<colorcode[i]<<")"<<endl;  

 }  

}

cout<<"Gray Code: "<<"(";

for(int i = 0;i<3;i++)

{

 if(i!=2)

 {

 cout<<graycode[i]<<",";  

 }

 else

 {

  cout<<graycode[i]<<")"<<endl;  

 }  

}

return 0;

}

You might be interested in
What is the first step you should take when you want to open a savings account?
pav-90 [236]
 First Go to the bank
Second Present Photo ID
 third Fill out application

I would think review the different savings account options that your bank offers...

Last Make initial deposit.



Hope that helps!!!

.
5 0
3 years ago
What is a word processing program? Give examples of word processing programs.
Kipish [7]

Answer:

A word processor, or word processing program, does exactly what the name implies. It processes words. It also processes paragraphs, pages, and entire papers. Some examples of word processing programs include Microsoft Word, WordPerfect (Windows only), AppleWorks (Mac only), and OpenOffice.org.

8 0
3 years ago
The java compiler is able to find all programmer errors.
Troyanec [42]
No compiler can do that. Maybe with AI, but that's beyond the scope of a compiler.
5 0
4 years ago
Need Help Please
erastova [34]

Answer:

1. siblings + 1

2. numberOfPizzas * pizzaCost

3. alienGreeting + alienGreeting2

4. color1 === color2

5. value1 - value2

6. console.log(gradeAverage === gradeAverage2)

7. numberToString + numberToString2

8. numberOfStudents / numberOfClassrooms

9. console.log(carSpeed === truckSpeed)

4 0
3 years ago
Define and explain the two different methods by which a file can be compressed. Briefly describe one pro and one con for both ty
Rina8888 [55]

Answer:

The answer to this question can be defined as follows:

Explanation:

In this question, the Lossy compression requires a data merging software program. The benefit would be that compared to lossless compressions, it can create smaller files. One aspect was that every piece of information is usually lost. It is used to analyze their digital information on a computer model, seeking a place to buy it in another form. The pre is also no loss of data. Another thing would be that sound files wouldn't fit properly.

4 0
3 years ago
Other questions:
  • What are the example of dedicated computers?
    5·1 answer
  • What is the definition of online communication
    15·1 answer
  • what’s The abbreviation of afk and what does That Mean in gaming playing in Multiplayer online battle arena games
    10·1 answer
  • The smallest unit of time in music called?
    6·2 answers
  • In microsoft what displays when the mouse pointer rests on selected text or data that can be formatted.
    8·1 answer
  • Why is the wizard able to install the printer when an actual print device is not connected to the computer??
    11·1 answer
  • Siva added a "Contact Form" to her website.
    10·1 answer
  • 5. What must be included in Turtle Graphics to move the Turtle around the screen?
    7·1 answer
  • In the computer science industry, the process of finding and removing errors from computer hardware or software is known as
    7·1 answer
  • Write a program which will -
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!