#C9960. RGB to Hexadecimal Conversion
RGB to Hexadecimal Conversion
RGB to Hexadecimal Conversion
The task is to convert given RGB color values to its corresponding hexadecimal color code. You are provided with three integers representing the red (R), green (G), and blue (B) components of a color. Each component is an integer between 0 and 255 (inclusive).
You must format the result as a string in the #RRGGBB
format where each component is represented as a two-digit uppercase hexadecimal number. The conversion should be done using the standard hexadecimal representation techniques. For example, an RGB value of (255, 0, 255) should result in #FF00FF
.
Note: Use LaTeX formatting for any mathematical expressions. For example, the range condition should be written as \(0 \leq r, g, b \leq 255\).
inputFormat
The input consists of a single line containing three space‐separated integers, representing the red, green, and blue components:
\(r\), \(g\), and \(b\) respectively with \(0 \leq r, g, b \leq 255\).
outputFormat
Output a single line containing the hexadecimal color code in the format #RRGGBB
where each pair of characters represents the two-digit uppercase hexadecimal value of the corresponding color component.
255 0 255
#FF00FF