CMY(K) is device dependent, unintuitive and perceptually non-linear;
To convert from RGB to CMY for printing, the simplest method is to convert from RGB to CIE XYZ and then from CIE XYZ to CMY(K). This is not a trivial process and ideally takes into consideration other factors - such as the printing inks being used, the type of press and screening, the paper, viewing conditions, lighting, etc.
Simple (and incorrect) transforms for RGB to CMY are given below;
RGB to CMY
Cyan = 1-Red Magenta = 1-Green Yellow = 1-BlueCMY to RGB
Red = 1-Cyan Green = 1-Magenta Blue = 1-YellowCMY to CMYK
Black = minimum (Cyan,Magenta,Yellow) Cyan = (Cyan-Black)/(1-Black) Magenta = (Magenta-Black)/(1-Black) Yellow = (Yellow-Black)/(1-Black)CMYK to CMY
Cyan = minimum(1,Cyan*(1-Black)+Black) Magenta = minimum(1,Magenta*(1-Black)+Black) Yellow = minimum(1,Yellow*(1-Black)+Black)These transforms may be sufficient if you simply want to specify CMY colours on an RGB display's user interface, but for printing, where any kind of colour match between display and print is desired, they are totally inaccurate.
If you want to try this kind of thing you're getting into the domain of colour management systems and should be reading Charle's Poynton's ColorFAQ.