Skip to content

Commit f921a1a

Browse files
Add files via upload
1 parent 4650fdc commit f921a1a

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

Patterns/pat28.java

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
public class pat28 {
2+
public static void main(String[] args)
3+
{
4+
/*
5+
6+
*
7+
* *
8+
* * *
9+
* * * *
10+
* * * * *
11+
* * * *
12+
* * *
13+
* *
14+
*
15+
16+
*/
17+
18+
//rows i , columns j
19+
20+
//change i, static j
21+
22+
for(int i=1; i<=5; i++)
23+
{
24+
for(int s=(5-i);s>=0;s--)//space is always rows - i, because i is values being printed
25+
System.out.print(" ");
26+
for(int j=1; j<= i; j++)
27+
{
28+
System.out.print("* ");
29+
}
30+
System.out.println();
31+
}
32+
33+
for(int i=4; i>=1; i--)
34+
{
35+
for(int s=(5-i);s>=0;s--)//space is always rows - i, because i is values being printed
36+
System.out.print(" ");
37+
for(int j=i; j>= 1; j--)
38+
{
39+
System.out.print("* ");
40+
}
41+
System.out.println();
42+
}
43+
}
44+
45+
}

0 commit comments

Comments
 (0)