## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

No credit card required

### 5.12. Nested Repetition Statements

Let us present another complete example. We use nested repetition statements to solve the problem. Consider the following problem statement:

Write a program that draws in the command prompt a filled square consisting solely of one type of character, such as the asterisk (*). The side of the square and the character to be used to fill the square should be entered by the user. The length of the side should not exceed 20 characters. If the user enters a value over 20, the message “Side is too large” should be printed.

Your program should draw the square as follows:

1. Input the side of the square.

2. Validate that the side is less than or equal to 20.

3. Use repetition to draw the square by printing only one fill character ...

## With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

No credit card required