#include #include #ifndef X #define X 71 #endif #ifndef Y #define Y 96 #endif static void putit(double d) { if (d < 0) d = 0; else if (d > 255) d = 255; printf("%d\n",(int)d); } int main(void); int main(void) { int x; int y; double r; double g; double b; printf("P3\n%d %d\n255\n",X,Y); for (y=0;y= 360) theta -= 360; r = (theta < 120) ? (((theta ) * 256) / 120) : (theta < 240) ? (((240 - theta) * 256) / 120) : 0; g = (theta < 120) ? 0 : (theta < 240) ? (((theta - 120) * 256) / 120) : (((360 - theta) * 256) / 120); b = (theta < 120) ? (((120 - theta) * 256) / 120) : (theta < 240) ? 0 : (((theta - 240) * 256) / 120); } putit(r); putit(g); putit(b); } } return(0); }