Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d818221

Browse files
committed
some complex patterns
1 parent f2c9658 commit d818221

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

src/binod/Pattern.java

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,55 @@ public static void main(String[] args) {
126126

127127
}
128128
}
129+
130+
class Pattern10{
131+
public static void inverted_rotated_half_pyramid(int n){
132+
//outer
133+
for(int i=1;i<=n;i++){
134+
//spaces
135+
for(int j=1;j<=n-i;j++){
136+
System.out.print(" ");
137+
}
138+
//stars
139+
for(int j=1;j<=i;j++){
140+
System.out.print("*");
141+
}
142+
System.out.println();
143+
}
144+
145+
}
146+
public static void main(String[] args) {
147+
inverted_rotated_half_pyramid(4);
148+
}
149+
}
150+
151+
class Pattern11{
152+
153+
public static void invertedHalfPyramidWithNumbers(int n){
154+
for(int i=1;i<=n;i++){
155+
for(int j=1;j<=n-i+1;j++){
156+
System.out.print(j);
157+
}
158+
System.out.println();
159+
}
160+
}
161+
public static void main(String[] args) {
162+
invertedHalfPyramidWithNumbers(5);
163+
}
164+
}
165+
166+
class Pattern12{
167+
public static void fLoydsTriangle(int n){
168+
int c=1;
169+
for(int i=1;i<=n;i++){
170+
for(int j=1;j<=i;j++){
171+
System.out.print(c+ " ");
172+
c++;
173+
}
174+
System.out.println();
175+
}
176+
}
177+
public static void main(String[] args) {
178+
fLoydsTriangle(5);
179+
}
180+
}

0 commit comments

Comments
 (0)