Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 42cae42

Browse files
Java Star Pattern (#2)
Prints the following pattern: * *** ***** ******* ********* ******* ***** *** *
1 parent c4009ac commit 42cae42

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

‎Misc Programmes/Java Star Pattern

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import java.io.*;
2+
public class JavaStarPattern
3+
{
4+
public static void main(String[]args)
5+
{
6+
int number=5;
7+
int count=number-1;
8+
for(int k=1;k<=number;k++)
9+
{
10+
11+
for(int i=1;i<=count;i++)
12+
System.out.print(" ");
13+
count--;
14+
for(int i=1;i<=2*k-1;i++)
15+
System.out.print("*");
16+
System.out.println();
17+
}
18+
count=1;
19+
for(int k=1;k<=number-1;k++)
20+
{
21+
for(int i=1;i<=count;i++)
22+
System.out.print(" ");
23+
count++;
24+
for(int i=1;i<=2*(number-k)-1;i++)
25+
System.out.print("*");
26+
System.out.println();
27+
}
28+
}
29+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /