C programming 3.21 LAB: Remove gray from RGB
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

Answers

Answer 1

The grey portion of the image is then represented by the average value of the three hues. In order to eliminate the grey from the image, we then subtract the grey value from each of the colour components.

How is the average colour determined?

To determine the red, green, and blue components of the final colour, sum up all the red, green, and blue values, then divide each by the number of pixels.

#include <stdio.h>

int main() {

   int red, green, blue, gray, new_red, new_green, new_blue;

   

   printf("Enter the red value: ");

   scanf("%d", &red);

   

   printf("Enter the green value: ");

   scanf("%d", &green);

   

   printf("Enter the blue value: ");

   scanf("%d", &blue);

   

(Red, Green, and Blue) / 3 for grey;

   

   new_red = red - gray;

   new_green = green - gray;

   new_blue = blue - gray;

   

 printf (new red, new green, and new blue, "New RGB values:%d%d%dn");

   

   return 0;

}

If you enter the values 130 50 130 as input, the program will output 80 0 80.

To know more about C programming visit:-

https://brainly.com/question/7344518

#SPJ1


Related Questions

A systems administrator is setting up a Windows computer for a new user Corporate policy requires a least privilege environment. The user will need to access advanced features and configuration settings for several applications.
Which of the following BEST describes the account access level the user will need?
Power user account
Standard account
Guest account
Administrator account

Answers

A standard account with specific permissions granted for the required applications is the best option to balance security with functionality for the user.

What is role of System Administrator in this scenario?

In this scenario, the best account access level for the user would be a standard account.

A standard account provides limited permissions and access to the system and applications, which is in line with the corporate policy of least privilege environment.

However, the user also requires access to advanced features and configuration settings for several applications.

In this case, the systems administrator can grant specific permissions to the standard user account to access these features and settings.

This can be achieved through user permissions, group policies or by assigning the user to a specific user group with the required privileges.

A power user account provides more privileges and access than a standard account, but it is still not equivalent to an administrator account.

A guest account is a restricted account type designed for temporary use by people who do not have regular access to the system.

An administrator account, on the other hand, has complete control over the system and applications, which would not be appropriate in this situation where the corporate policy requires a least privilege environment.

To know more about system administrator , visit: https://brainly.com/question/27129590

#SPJ1

What does voltage describe?how fast current can flowhow much current can flowhow much a material resists electrical flowhow fast a material conducts electrical flow.

Answers

Voltage is a term used to define the potential difference between two places that, when linked permits current to flow.

The potential energy per unit charge that occurs between two places in an electrical circuit is measured by voltage. It is often referred to as electrical potential difference or electromotive force. When two points are linked, current can flow due to the potential difference between the two locations which is measured by voltage. The potential for current to flow increases with voltage because each charge has more energy. The letter V stands for voltage which is expressed in volts. Voltage is a crucial notion in circuit design because it makes it possible to estimate how much current will flow through a circuit. Voltage is a function of the circuit's energy capacity which is influenced by the power source the resistance of the circuit's components and the current that is flowing through it.

Learn more about voltage here-

brainly.com/question/29445057

#SPJ4

Select the correct answer from each drop-down menu.
What is rapid prototyping?
Rapid prototyping is a method of creating a
prototyping is commonly known as
model of a part or a product from the original model of the product. Rapid

Answers

Note that Rapid prototyping is a method of creating a model of a part or a product from the original design. Rapid prototyping is commonly known as 3D printing.

Why is rapid prototyping Important?

Rapid prototyping is important because it allows for the quick and cost-effective creation of a physical model of a product or part. It allows designers to test and refine their designs before investing in expensive production methods.

This can save time and money by identifying flaws and potential improvements early in the design process.

Rapid prototyping can also help to improve communication and collaboration among team members and stakeholders by providing a tangible representation of the product. Note as well that, it can reduce waste by allowing for more precise manufacturing and minimizing the need for rework or corrections.

Learn more about rapid prototyping:

https://brainly.com/question/30655140

#SPJ1

Select the correct statements about cloud computing.A. cloud computing is internet-based. B. the major concern of using cloud computing is issues on privacy and security. C. companies using cloud computing often share resources and applications. D. most erp systems cannot be host in the cloud.

Answers

Note that the correct statements about. cloud computing  are:

A. cloud computing is internet-based. B. the major concern of using cloud computing is issues on privacy and security. C. companies using cloud computing often share resources and applications.

What is the rationale for the above response?  

The response is based on the characteristics of cloud computing and the capabilities of modern ERP systems.

Cloud computing relies on internet-based access to shared resources and applications, which allows for efficient use of computing resources and facilitates collaboration.

Security and privacy concerns are valid considerations when using cloud computing. However, modern ERP systems are designed to work in the cloud and many businesses have successfully migrated their ERP systems to the cloud to take advantage of its benefits.

Learn more about cloud computing  at:

https://brainly.com/question/29737287

#SPJ1

C programming 3.26 LAB: Leap year
A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:

1) The year must be divisible by 4

2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400; therefore, both 1700 and 1800 are not leap years

Some example leap years are 1600, 1712, and 2016.

Write a program that takes in a year and determines whether that year is a leap year.

Ex: If the input is 1712, the output is:

1712 - leap year

Answers

The code below is in Java. It uses if else structure and modulo operator to check if a given year is a leap year or not. Recall that modulo operator is used to get the remainder of the division. ⇒ a % b = remainder.

What is C programming?

The general-purpose programming language C is effective. The creation of software such as operating systems, databases, compilers, and other tools is possible with it. C is a great language for beginners to learn programming with.

These C tutorials will lead you step-by-step as you learn C programming.

Low-level memory access, a small collection of keywords, and a clean style are the fundamental characteristics of the C programming language, which makes it ideal for system programming like operating system or compiler development.

Therefore, The code below is in Java. It uses if else structure and modulo operator to check if a given year is a leap year or not. Recall that modulo operator is used to get the remainder of the division. ⇒ a % b = remainder.

To learn more about C programming, refer to the link:

https://brainly.com/question/10895516

#SPJ1

visit the transmission versus propagation delay interactive animation at the companion web site. among the rates, propagation delay, and packet sizes available, find a combination for which the sender finishes transmitting before the first bit of the packet reaches the receiver. find another combination for which the first bit of the packet reaches the receiver before the sender finishes transmitting.

Answers

The length of the packet will determine how long the transmission delay is, whereas the propagation delay is the amount of time required for a bit to travel to the other end of the network.

How are transmission and propagation delays determined?

Propagation delay is the amount of time it takes for a bit to get from the transmitter to the receiver end of the link. Mathematically, Distance between sender and receiver = Propagation delay. Transmission speed / propagation delay.

What does the applet for transmission versus propagation delay do?

The time it takes the router to push out the packet is known as the transmission delay. The propagation delay is the amount of time needed for a bit to move from one router to the next.

To know more about network visit:-

https://brainly.com/question/29350844

#SPJ1

A derived class method with the same name, parameters, and return type as a base class method is said to _____ the base class's method. Select one: a. overload b. override
c. inherit d. copy

Answers

A derived class method with the same name, parameters, and return type as a base class method is said to override the base class's method. Therefore, the correct option is Option B. override.

What is the rationale for the above response?

Method overriding is a feature of object-oriented programming that allows a subclass or derived class to provide its own implementation of a method that is already defined in its superclass or base class.

When a method in the derived class has the same name, parameters, and return type as a method in the base class, it is said to override the base class's method. The overridden method in the base class is replaced by the method in the derived class when the method is called on an object of the derived class.

The purpose of method overriding is to provide a specialized implementation of a method in a subclass that is specific to that subclass's behavior.

Learn more about derived class at:

https://brainly.com/question/15859663

#SPJ1

Other Questions
What does this mean? "you must first enable the government to control the governed" central idea of the passage The Duty and Honor f Lee and Grant Who is the United States Administrator of the Small Business Administration? explain what determines the ratio of positive ions to negative ions in an ionic crystal In a large population of approximately 1 million E. coli , one bacterium gains a mutation that gives it a fitness advantage , with a selective coefficient of . Which of the following statements is FALSE ? s = 0.001 Given the population size , the selective coefficient is large enough to overcome genetic drift . It is possible that the mutation could be lost from the population due to genetic drift . The mutation will likely sweep through the population to fixation if the individual has offspring with the new mutation Ans = 0.001 would not be considered large given that population size . what is the mood and tone of the story the night before the invasion Cardiac muscle can use fatty acids, ______, lactic acid, amino acids, and ______ bodies as fuel sources What was the consequences of ire what thoughts made him more agitated after insertion of a speculum into the vagina, laser ablation was performed to cauterize the outer cells of the cervix. assigne CPT code and modifier! How many percent alcohol content in beer? what is 10k is how many miles? A principal factor in the population shift westward in the 1850s wasa. a war with Mexicob. the Erie Canalc. a gold rushd. a "nitrate rush.&quote. agricultural expansion in the Great Plains How did Darwin and Wallace contribute to evolution by natural selection? The Maya were truly ahead of their time, yet they seem to be placed in a subordinate tier when discussing the world's most advanced civilizations. Write a short essay explaining why the Maya should be considered one of the most advanced civilizations of all time. Be sure to cite and provide reasons to support your main idea.PLEASE HELP!!!! what happens in a perfectly competitive industry when economic profit is greater than zero? group of answer choices there may be pressure on the market price to fall new firms may enter the industry and all of the above firms may move along their lrac curves to new outputs existing firms may expand their operations A merry-go-round rotates at the rate of0.14 rev/s with an 100 kg man standing ata point 2.1 m from the axis of rotation.What is the new angular speed when theman walks to a point 0 m from the center?Consider the merry-go-round is a solid 83 kgcylinder of radius of 2.1 m.Answer in units of rad/s. part2: What is the change in kinetic energy due tothis movement?Answer in units of J. a system that can interact with its environment undergoes a natural, spontaneous process. Mrs.baxter deposits 2000 into an account that earns 5% simple interest how much is mrs baxters investment worth after 8 years What formula should be used Identify the policy under which an employer refuses to hire or terminates a worker whose spouse works at a competing firm. a. Anti-nepotism policy b. Antitrust policy c. Affirmative action policy d. Conflict-of-interest policy write an essay on the role of women in science. how women have been able to break free and conquer barriers in the science and tech world