-
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 #646 from vijayv18/java-programs
Java programs
- Loading branch information
Showing
15 changed files
with
271 additions
and
72 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
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -18,3 +18,15 @@ public static void main(String[] args) { | |
} | ||
} | ||
} | ||
|
||
/* | ||
The output for the above program. | ||
* | ||
* | ||
* | ||
* | ||
* | ||
*/ |
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,32 @@ | ||
public class StarPattern11 { | ||
public static void main(String[] args) { | ||
for(int i=1;i<=5;i++) { | ||
for(int j=5;j>=i;j--) { | ||
System.out.print(" "); | ||
} | ||
for(int k=1;k<(i*2);k++) { | ||
if(k>1 && k<(i*2)-1) | ||
System.out.print(" "); | ||
else | ||
System.out.print("*"); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} | ||
|
||
/* | ||
The output for the above program. | ||
* | ||
* * | ||
* * | ||
* * | ||
* * | ||
*/ | ||
|
||
|
||
|
||
|
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,29 @@ | ||
public class StarPattern12 { | ||
|
||
public static void main(String[] args) { | ||
for(int i=5;i>=1;i--) { | ||
for(int j=5;j>=i;j--) { | ||
System.out.print(" "); | ||
} | ||
for(int k=1;k<(i*2);k++) { | ||
if(k>1 && k<(i*2)-1) | ||
System.out.print(" "); | ||
else | ||
System.out.print("*"); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} | ||
|
||
/* | ||
The output for the above program. | ||
* * | ||
* * | ||
* * | ||
* * | ||
* | ||
*/ |
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,28 @@ | ||
public class StarPattern13 { | ||
|
||
public static void main(String[] args) { | ||
for(int i=1;i<=5;i++) { | ||
for(int j=1;j<=5;j++) { | ||
if (i>1 && i<5 && j>1 && j<5) | ||
System.out.print(" "); | ||
else | ||
System.out.print("*"); | ||
} | ||
System.out.println(); | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
/* | ||
The output for the above program. | ||
***** | ||
* * | ||
* * | ||
* * | ||
***** | ||
*/ |
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 StarPattern14 { | ||
|
||
public static void main(String[] args) { | ||
for(int i=0;i<5;i++) { | ||
for(int j=0;j<5;j++) { | ||
if(i==j || i+j==5-1) | ||
System.out.print("*"); | ||
else | ||
System.out.print(" "); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
} | ||
|
||
/* | ||
The output for the above program. | ||
* * | ||
* * | ||
* | ||
* * | ||
* * | ||
*/ |
Oops, something went wrong.