0% found this document useful (0 votes)
88 views6 pages

Java Nested For Loops Patterns Guide

The document provides a series of Java programming exercises focused on using nested for loops to display various patterns. Each exercise includes specific patterns to be printed, such as numbers, letters, and symbols, with different configurations and arrangements. The exercises aim to enhance understanding of nested loops and pattern generation in Java.

Uploaded by

deepak0478
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
88 views6 pages

Java Nested For Loops Patterns Guide

The document provides a series of Java programming exercises focused on using nested for loops to display various patterns. Each exercise includes specific patterns to be printed, such as numbers, letters, and symbols, with different configurations and arrangements. The exercises aim to enhance understanding of nested loops and pattern generation in Java.

Uploaded by

deepak0478
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

o Java Nested for Loops o Java Nested for Loops

WAP in Java to display the following pattern: WAP in Java to display the following pattern:
1 5
22 44
333 333
4444 2222
55555 11111
o Java Nested for Loops o Java Nested for Loops
WAP in Java to display the following pattern: WAP in Java to display the following pattern:
54321 3
4321 44
321 555
21 6666
1 77777
o Java Nested for Loops  Java Nested for Loops
Write the program in Java to display the following Write the program in Java to display the following
pattern: pattern:
1 99999
21 77777
321 55555
4321 33333
54321 11111
o Java Nested for Loops  Java Nested for Loops
Write the program in Java to display the following Write the program in Java to display the following
pattern: pattern:
12345 9
1234 79
123 579
12 3579
1 13579
o Java Nested for Loops  Java Nested for Loops
WAP in Java to display the following pattern: Write the program in Java to display the following
54321
pattern:
5432 9
543 97
54 975
5 9753
o Java Nested for Loops 97531
Write the program in Java to display the following
 Java Nested for Loops
pattern:
WAP in Java to display the following pattern:
13579
1
1357
2 3
135
4 5 6
13
7 8 9 10
1
11 12 13 14 15
o Java Nested for Loops
Write the program in Java to display the following  Java Nested for Loops
pattern: WAP in Java to display the following pattern:
5 1
54 11
543 101
5432 1001
54321  Java Nested for Loops
o Java Nested for Loops WAP in Java to display the following pattern:
Write the program in Java to display the following 1
pattern: 23
12345 345
2345 4567
345 56789
45
5

1
 Java Nested for Loops 44445
WAP in Java to display the following pattern: 55555
1  Java Nested for Loops
12 WAP in Java to display the following pattern for n
123 number of rows (take n as input from user):
1234 Enter number of rows: 5
12345 abcdedcba
 Java Nested for Loops abcdedc
WAP in Java to display the following pattern: abcde
1 abc
21 a
321  Java Nested for Loops
4321 WAP in Java to display the following pattern:
54321 A
 Java Nested for Loops AB
WAP in Java to display the following pattern: ABC
1 ABCD
31 ABCDE
531  Java Nested for Loops
7531 WAP in Java to display the following pattern:
 Java Nested for Loops A
WAP in Java to display the following pattern: AB
1 ABC
31 ABCD
531 ABCDE
7531  Java Nested for Loops
97531 WAP in Java to display the following pattern:
 Java Nested for Loops Exam
WAP in Java to display the following pattern: xam
1 2 3 4 5 am
6 7 8 9 m
10 11 12  Java Nested for Loops
13 14 WAP in Java to display the following pattern:
15 bo
 Java Nested for Loops tt
WAP in Java to display the following pattern: le
15 14 13 12 11 s
10 9 8 7  Java Library Classes
654 WAP in Java to display the following pattern:
32 a
1 ce
 Java Nested for Loops gik
WAP in Java to display the following pattern: moqs
1  Java Library Classes
10 WAP in Java to display the following pattern:
101 A
1010 ab
10101 ABC
 Java Nested for Loops abcd
WAP in Java to display the following pattern: ABCDE
55555  Java Library Classes
4444 WAP in Java to display the following pattern:
333 ZYXWU
22 ZYXW
1 ZYX
 Java Nested for Loops ZY
WAP in Java to display the following pattern: Z
12345
22345
33345

2
 Java Library Classes  Java String Handling
WAP in Java to display the following pattern: WAP to display the pattern:
ABCDE ABCDE
ABC BCDE
A CDE
 Java Library Classes DE
WAP in Java to display the following pattern: E
PRTV  Java String Handling
PRT WAP to display the pattern:
PR A
P BC
 Java Library Classes DEF
WAP in Java to display the following pattern: GHIJ
A*B*C*D*E* KLMNO
A*B*C*D*  Java String Handling
A*B*C* WAP to display the pattern:
A*B* ABCDE
A* ABCDA
ABCAB
 Java Library Classes ABABC
WAP in Java to display the following pattern: AABCD
aaaaa  Java Nested for Loops
bbbbb WAP in Java to display the following pattern:
AAAAA *
BBBBB ***
 Java String Handling *****
WAP to accept a word (say, BLUEJ) and display the *******
pattern: *********
BLUEJ  Java Nested for Loops
BLUE WAP in Java to display the following pattern:
BLU *
BL **
B ***
 Java String Handling ****
WAP to accept a word (say, BLUEJ) and display the *****
pattern:  Java Nested for Loops
J WAP in Java to display the following pattern:
EE *****
UUU ****
LLLL ***
BBBBB **
 Java String Handling *
WAP in Java to display the following pattern:  Java Nested for Loops
AAAAA WAP in Java to display the following pattern:
BBBB $#$#$
CCC $#$#
DD $#$
E $#
 Java String Handling $
WAP to accept a word (say, BLUEJ) and display the  Java Nested for Loops
pattern: WAP in Java to display the following pattern:
BLUEJ 1*3*5
LUEJ *3*5*
UEJ 3*5*7
EJ *5*7*
J 5*7*9

3
 Java Nested for Loops  Java Nested for Loops
WAP in Java to display the following pattern: WAP to generate a triangle or an inverted triangle till n
1**** terms based upon the user's choice.
22*** Example 1:
333** Input: Type 1 for a triangle and
4444* Type 2 for an inverted triangle
55555 Enter your choice 1
 Java Nested for Loops Enter the number of terms 5
WAP in Java to display the following pattern: Sample Output:
1234554321 1
1234 4321 22
123 321 333
12 21 4444
1 1 55555
 Java Nested for Loops Example 2:
WAP in Java to display the following pattern: Input: Type 1 for a triangle and
12345 Type 2 for an inverted triangle
2345 Enter your choice 2
345 Enter the number of terms 6
45 Sample Output:
5 666666
45 55555
345 4444
2345 333
12345 22
1
 Java Nested for Loops
Using the switch statement, write a menu driven  Java Nested for Loops
program to print the following patterns based on user's Using the switch statement, write a menu driven
choice: program for the following:
Pattern 1: (a) To print the Floyd's triangle:
11 1
12 22 2 3
13 23 33 4 5 6
14 24 34 44 7 8 9 10
15 25 35 45 55 11 12 13 14 15
Pattern 2: (b) To display the following pattern:
1 I
01 IC
101 ICS
0101 ICSE
10101 For an incorrect option, an appropriate error message
should be displayed.
 Java Nested for Loops
Write a menu driven program to generate pattern as  Java String Handling
follows: WAP to generate a triangle or an inverted triangle till n
For choice 1: terms based upon the User’s choice of the triangle to
1 be displayed.
2*3 Example 1:
4*5*6 Input: Type 1 for a triangle and
7*8*9*0 Type 2 for an inverted triangle
For choice 2: Enter your choice 1
5**** Enter the number of terms 5
4### Sample Output:
3** *****
2# ****
1 ***
**
*

4
Example 2:  Java Nested for Loops
Input: Type 1 for a triangle and WAP in Java to display the following pattern:
Type 2 for an inverted triangle 3
Enter your choice 2 56
Enter the number of terms 5 8 9 10
Sample Output: 12 13 14 15
ABCDE  Java Nested for Loops
ABCD WAP in Java to display the following pattern:
ABC 12345
AB 22345
A 32345
 Java String Handling 42345
WAP to generate a triangle or an inverted triangle 52345
based upon User’s choice.  Java Nested for Loops
Example 1: WAP in Java to display the following pattern:
Input: Type 1 for a triangle and 1
Type 2 for an inverted triangle 26
Enter your choice 1 3 7 10
Enter a word : BLUEJ 4 8 11 13
Sample Output: 5 9 12 14 15
B
 Java Nested for Loops
LL WAP in Java to display the following pattern:
UUU 123454321
EEEE 1234321
JJJJJ 12321
Example 2: 121
Input: Type 1 for a triangle and 1
Type 2 for an inverted triangle
 Java Nested for Loops
Enter your choice 2
WAP in Java to display the following pattern:
Enter a word : BLUEJ
5
Sample Output:
454
BLUEJ
34543
BLUE
2345432
BLU
123454321
BL
B  Java Nested for Loops
WAP in Java to display the following pattern:
 Java Nested for Loops
225 196 169 144 121
WAP in Java to display the following pattern:
100 81 64 49
11
36 25 16
12 22
9 4
13 23 33
1
14 24 34 44
15 25 35 45 55  Java Nested for Loops
WAP in Java to display the following pattern:
 Java Nested for Loops
1
WAP in Java to display the following pattern:
00
1
111
3 5
0000
5 7 9
11111
7 9 11 13
9 11 13 15 17  Java Nested for Loops
WAP in Java to display the following pattern:
 Java Nested for Loops
11111
WAP in Java to display the following pattern:
0000
11 13 15
111
17 19
00
21
1
 Java Nested for Loops
WAP in Java to display the following pattern:
1
9 25 49
81 121 169 225 289

5
 Java Nested for Loops  Java Nested for Loops
WAP in Java to display the following pattern: WAP in Java to display the following pattern:
12345 13579
23456 35791
34567 57913
45678 79135
56789 91357
 Java Nested for Loops
WAP in Java to display the following pattern:
5
54
543
5432
54321
 Java Nested for Loops
WAP in Java to display the following pattern:
1
35
7 9 11
13 15 17 19
21 23 25 27 29
 Java Nested for Loops
WAP in Java to display the following pattern:
****1
***12
**123
*1234
12345

 Java Nested for Loops


WAP in Java to display the following pattern:
13579
3579
579
79
9
 Java Nested for Loops
WAP in Java to display the following pattern:
1 7 12 16 19 21
2 8 13 17 20
3 9 14 18
4 10 15
5 11
6
 Java Nested for Loops
WAP in Java to display the following pattern:
7
76
765
7654
76543
765432
7654321
 Java Nested for Loops
WAP in Java to display the following pattern:
2
3 5
7 11 13
17 19 23 29
31 37 41 43 47

You might also like