Skip to content

Commit b5ead7e

Browse files
Loop
1 parent b7085c3 commit b5ead7e

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

2.Loop/Pattern/program35.java

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
2+
3+
4+
/*
5+
* * * * * * *
6+
* * * * *
7+
* * *
8+
*
9+
* * *
10+
* * * * *
11+
* * * * * * *
12+
*/
13+
14+
15+
16+
17+
18+
19+
20+
package Pattern;
21+
22+
public class program35 {
23+
24+
public static void main(String[] args) {
25+
26+
int row = 4;
27+
int col = 7;
28+
int sp = 0;
29+
for(int i=1;i<=2*row-1;i++){
30+
31+
if(i<row){
32+
33+
for(int j=1;j<=sp;j++){
34+
System.out.print(" ");
35+
}
36+
37+
for(int k=1;k<=col;k++){
38+
System.out.print("* ");
39+
}
40+
41+
sp +=2;
42+
col-=2;
43+
}
44+
45+
else{
46+
47+
48+
for(int j=1;j<=sp;j++){
49+
System.out.print(" ");
50+
}
51+
52+
for(int k=1;k<=col;k++){
53+
System.out.print("* ");
54+
}
55+
56+
col +=2;
57+
sp -=2;
58+
59+
}
60+
61+
62+
System.out.println();
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)