Cristiano Magro
2025-10-05 12a2fa369bebf06753654ae56d607465419b0553
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
public class CMYKtoRGB {
    public static void main(String[] args) {
        double c = Double.parseDouble(args[0]);
        double m = Double.parseDouble(args[1]);
        double y = Double.parseDouble(args[2]);
        double k = Double.parseDouble(args[3]);
 
        double w = 1 - k;
        int r = (int) Math.round(255 * w * (1 - c));
        int g = (int) Math.round(255 * w * (1 - m));
        int b = (int) Math.round(255 * w * (1 - y));
 
        System.out.println("red   = " + r);
        System.out.println("green = " + g);
        System.out.println("blue  = " + b);
    }
}