A digital world colors are specified in Red ,Green ,Blue(RGB) format with value of (R,G,b) varying on integers scale from 0 to 255 in point publishing the colors are mentioned in cyan, magenta - yellow black (CMYK) format ,with value of C,M,Y and k varying on real scale from 0.0 to 1.0 write the program to convert RGB colors to CMYK as per the following formula..White=max(Red/255,Green/255,Blue/255) ,cyan=(white-Red/255)/white , Magenta=(white -Green/255)/white , black = 1-white. note that if RGB value are 0 then the cmy values are all 0 and the k value is 1.

A digital world colors are specified in Red ,Green ,Blue(RGB) format with value of (R,G,B) varying on integers scale from 0 to 255 in point publishing the colors are mentioned in cyan, magenta - yellow black (CMYK) format ,with value of C,M,Y and k varying on real scale from 0.0 to 1.0 write the program to convert RGB colors to CMYK as per the following formula..

White=max(Red/255,Green/255,Blue/255),

cyan=(white-Red/255)/white 

Magenta=(white -Green/255)/white

 black = 1-white. 

 note that if RGB value are all 0 then the cmy values are all 0 and the k value is 1.

#include<stdio.h>

#include<conio.h>

int main()

{

float r,g,b,rf, gf,bf, max,w,c,y ,m,k;

printf(" Enter the value of red (0to 255):");

scanf("%f",&r);

printf("Enter the value of green(0 to 255):");

scanf("%f",&g);

printf("Enter the value of value of blue(0 to 255):");

scanf("%f",&b);

rf=r/255;

gf=g/255;

bf=b/255;

printf("Red:%f\n Green:%f\nBlue:%f\n",rf,gf ,bf) ;

// find the maximum  all of  them

max=rf;

if (max<gf)

max=gf;

if(max<bf)

max=bf;

//w stand for white

w=max;

printf("white :%f\n\n",w);

c=(w- rf)/w;

m=(w-gf)/w;

y=(w-bf)/w;

k=1-w;

printf("The value of cyan:%f\n",c);

printf("The value of magenta:%f\n",m);

printf("The value of yellow:%f\n",y);

printf("The value of black:%f\n",c); 


related program--

1..if the three of triangle are entered through the keyboard write a program to check whether the triangle is isosceles equilateral ,scalene or right angle triangle.

2.Wind chill factor is the felt air temperature on exposed skin due to wind chill temperature is always lower than the air temperature ,and is calculated as per the following formula: wcf=35.74+0.6215t+(0.4275-35.75)*v^0.16. where t is the temperature and v is the wind velocity .write a program to receive values of t and v and calculate wind chill factor (wcf).

3.If the three of triangle are entered through the keyboard write a program to check whether the triangle is isosceles equilateral ,scalene or right angle triangle.

4.Two number are input through the keyboard into two locations C and D write a program to interchange the contents of C and D. 



 

Comments

Popular posts from this blog

class with array in c++ (memory allocatin & using array in classes)

constructor with default arguments

constructor overloading in c++ programming