#include #include using namespace std; int main() { int nrows {20}; // number of rows of pixels int ncols {30}; // number of columns of pixels cout << "P3\n" << ncols << " " << nrows << "\n" << 255 << "\n"; for (int col {0}; col < ncols; ++col) { for (int row {0}; row < nrows; ++row) { if (col < ncols / 3) { cout << "0 146 70\n"; // green } else if (col < 2 * ncols / 3) { cout << "255 255 255\n"; // white } else { cout << "206 17 38\n"; // red } } } return EXIT_SUCCESS; }