/* hexcolor */ #include #include char *usage[] = { " Usage: hexcolor r g b", " Enter the three RBG color values in the", " range of 0 to 256. The output is both a", " 24-bit and 48-bit hexadecimal number of the", " color that can be used in an XPM file." }; int main(int argc,char *argv[]) { int i; int r,g,b; if(argc < 4) { for(i=0; i<5; i++) printf("%s\n",usage[i]); exit(1); } r = atoi(argv[1]); g = atoi(argv[2]); b = atoi(argv[3]); printf("#%02X%02X%02X\n",r,g,b); printf("#%02X00%02X00%02X00\n",r,g,b); exit(0); }