/* * Program to print rectangle of 'X' as an example of using nested loops. */ #include int main(void) { int rows, cols; printf("enter rows, cols\n"); if (scanf("%d %d", &rows, &cols) != 2) { printf("not numbers\n"); return 1; } /* print rows */ for (int c = 0; c < cols; ++c) { /* print a row */ for (int r = 0; r < rows; ++r) { putchar('X'); } putchar('\n'); } return 0; }