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