Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program ColorToHex;
- const
- c = clYellow;
- var
- r, g, b: Integer;
- function Hex(num: Integer): string;
- var
- i: Integer;
- begin
- Result := '00';
- i := num div 16;
- if i < 10 then
- Result[1] := Chr(Ord('0') + i)
- else
- Result[1] := Chr(Ord('A') + (i - 10));
- i := num mod 16;
- if i < 10 then
- Result[2] := Chr(Ord('0') + i)
- else
- Result[2] := Chr(Ord('A') + (i - 10));
- end;
- begin
- ColortoRGB(c, r, g, b);
- Writeln(Hex(r) + Hex(g) + Hex(b));
- end.
Add Comment
Please, Sign In to add comment