Skip to content

Commit

Permalink
Merge pull request #644 from vijayv18/star-patterns-vijay
Browse files Browse the repository at this point in the history
add star pattern java programs
  • Loading branch information
mergify[bot] authored Oct 7, 2023
2 parents eab8154 + 418fcd3 commit d980e1e
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Java/Star Patterns/StarPattern1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public class StarPattern1 {
public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=1;j<=i;j++) {
System.out.print("*");
}
System.out.println();
}
}
}
20 changes: 20 additions & 0 deletions Java/Star Patterns/StarPattern10.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class StarPattern10 {

public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=4;j>=i;j--) {
System.out.print(" ");
}
for(int k=1;k<=i;k++) {
if(i>1 && k>1) {
System.out.print(" ");
}
else
{
System.out.print("*");
}
}
System.out.println();
}
}
}
11 changes: 11 additions & 0 deletions Java/Star Patterns/StarPattern2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class StarPattern2 {

public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=5;j>=i;j--) {
System.out.print("*");
}
System.out.println();
}
}
}
18 changes: 18 additions & 0 deletions Java/Star Patterns/StarPattern3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
public class StarPattern3 {

public static void main(String[] args) {
for(int i=1;i<=5;i++)
{
for(int j=4;j>=i;j--)
{
System.out.print(" ");
}
for(int k=1;k<=i;k++)
{
System.out.print("*");
}
System.out.println();
}
}
}

16 changes: 16 additions & 0 deletions Java/Star Patterns/StarPattern4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
public class StarPattern4 {

public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=1;j<=i;j++) {
System.out.print(" ");
}
for(int k=5;k>=i;k--) {
System.out.print("*");
}
System.out.println();
}

}

}
26 changes: 26 additions & 0 deletions Java/Star Patterns/StarPattern5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
public class StarPattern5 {

public static void main(String[] args) {

for(int i=1;i<=5;i++) {
for(int j=4;j>=i;j--) {
System.out.print(" ");
}
for(int k=1;k<=i;k++) {
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=4;k>=i;k--) {
System.out.print("*");
}
System.out.println();
}

}
}
17 changes: 17 additions & 0 deletions Java/Star Patterns/StarPattern6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class StarPattern6 {

public static void main(String[] args) {
for(int i=1;i<=5;i++)
{
for(int j=4;j>=i;j--)
{
System.out.print(" ");
}
for(int k=1;k<=i;k++)
{
System.out.print(" *");
}
System.out.println();
}
}
}
17 changes: 17 additions & 0 deletions Java/Star Patterns/StarPattern7.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class StarPattern7 {

public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=4;j>=i;j--) {
System.out.print(" ");
}
for(int k=1;k<=i;k++) {
System.out.print("*");
}
for(int l=2;l<=i;l++) {
System.out.print("*");
}
System.out.println();
}
}
}
14 changes: 14 additions & 0 deletions Java/Star Patterns/StarPattern8.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class StarPattern8 {

public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=1;j<=i;j++) {
System.out.print(" ");
}
for(int k=10;k>=(i*2);k--) {
System.out.print("*");
}
System.out.println();
}
}
}
17 changes: 17 additions & 0 deletions Java/Star Patterns/StarPattern9.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class StarPattern9 {

public static void main(String[] args) {
for(int i=1;i<=5;i++) {
for(int j=1;j<=i;j++) {
if(i>1 && j<i) {
System.out.print(" ");
}
else
{
System.out.print("*");
}
}
System.out.println();
}
}
}

0 comments on commit d980e1e

Please sign in to comment.