-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #644 from vijayv18/star-patterns-vijay
add star pattern java programs
- Loading branch information
Showing
10 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} | ||
} |