Skip to content

Commit

Permalink
Add StarPattern15 Java
Browse files Browse the repository at this point in the history
  • Loading branch information
vijayv18 committed Oct 13, 2023
1 parent cbb01d8 commit 620fcef
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions Java/Star Patterns/StarPattern15.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
public class StarPattern15 {

public static void main(String[] args) {
for(int a=1;a<=9;a++)
{
System.out.print("* ");
}
System.out.println();

for(int i=2;i<=5;i++)
{
for(int j=5;j>=i;j--)
{
System.out.print("* ");
}
for(int k=4;k<=i*2;k++)
{
System.out.print(" ");
}
for(int l=5;l>=i;l--)
{
System.out.print("* ");
}
System.out.println();
}

for(int i=1;i<=4;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print("* ");
}
for(int k=8;k>=i*2;k--)
{
System.out.print(" ");
}
for(int l=1;l<=i;l++)
{
System.out.print("* ");
}
System.out.println();
}

for(int a=1;a<=9;a++)
{
System.out.print("* ");
}
System.out.println();



}
}

/*
The output for the above program.
* *
* * * *
* * * * * *
* * * * * * * *
* * * * * * * * *
*/

0 comments on commit 620fcef

Please sign in to comment.