Programming Homework Help
Programming Homework Help. java code question !!
(Display four patterns using loops) Ask the user to enter an integer to
set a limit for nested loops and generate the following four patterns:
Enter an integer to be a limit of the pattern:6
Pattern A:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
Pattern B:
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
Pattern D:
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
SAMPLE RUN #1
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
1
1 2
1 2 3
1 2 3 4
Pattern B:
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
Pattern D:
1 2 3 4
1 2 3
1 2
1
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LoopPattern
Enter an integer to be a limit of the pattern: 4
Pattern A:
1
1 2
1 2 3
1 2 3 4
Pattern B:
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
Pattern D:
1 2 3 4
1 2 3
1 2
1
SAMPLE RUN #2
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
Pattern B:
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
Pattern D:
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LoopPattern
Enter an integer to be a limit of the pattern: 6
Pattern A:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
Pattern B:
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
Pattern D:
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
SAMPLE RUN #3
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
Pattern B:
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
Pattern D:
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LoopPattern
Enter an integer to be a limit of the pattern: 8
Pattern A:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8
Pattern B:
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
6 5 4 3 2 1
7 6 5 4 3 2 1
8 7 6 5 4 3 2 1
Pattern D:
1 2 3 4 5 6 7 8
1 2 3 4 5 6 7
1 2 3 4 5 6
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
SAMPLE RUN #4
— Prompts For Keyboard/Console/Standard Input —
Inputs
— Keyboard/Console/Standard Input stdin —
Outputs
— Monitor/Console/Standard Output —
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Pattern B:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
Pattern D:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
What The Console Looks Like In An Interactive Session:
(Note: this combines standard input with standard output )
>java LoopPattern
Enter an integer to be a limit of the pattern: 5
Pattern A:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
Pattern B:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Pattern C:
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
Pattern D:
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1