/* File: nested7.c Revisit nested for loops. */ #include int main() { int rows, row_length ; int i, j ; printf("Enter # of rows: ") ; scanf("%d", &rows) ; printf("Enter length of each row: ") ; scanf("%d", &row_length) ; for (i = 1 ; i <= rows ; i++) { for (j = 1 ; j <= row_length ; j++) { if ( i == 1 || i == rows ) { printf(" * ") ; } else if ( j == 1 || j == row_length) { printf(" * ") ; } else if ( j == i ) { printf(" * ") ; } else if ( i + j == row_length + 1 ) { printf(" * ") ; } else { printf(" . ") ; } } // print newline at the end of each row printf("\n") ; } return 0 ; }