Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

Can we make a c program, of which we tell two colors and it will tell what it is equals to?

–3 votes
asked Nov 25, 2020 by Superman365 (500 points)
Can we make a c program, of which we tell two colors and it will tell what it is equals to?

Example:

(Me): What is blue + red?

(Bot): Purple.

1 Answer

+2 votes
answered Nov 25, 2020 by Peter Minarik (19,180 points)
This is just checking words. You can create all the possible combinations and check them.

If you really want to work with colors, they are represented by 3 color components on computers. These are typically red, green, blue.

For instance, the blue color is (0, 0, 1); i.e. 0 red, 0 green and 1 blue.

If you want deeper blue, you'd do (0, 0, 0.5) for instance.

So red (1, 0, 0) + blue (0, 0, 1) would result in (1, 0, 1).
commented Nov 25, 2020 by Superman365 (500 points)
So, what is the program?
commented Nov 26, 2020 by Peter Minarik (19,180 points)
It depends on what you want: simple word check, or actual arithmetics with colors.

Also, you could learn way more if you'd give it a go and try to do something first. Then ask questions, when you get stuck. ;)
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...