-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e124498
commit 472a9dc
Showing
4 changed files
with
82 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/*Print the following pattern: Inverted Half Peramid | ||
* * * * | ||
* * * | ||
* * | ||
* | ||
*/ | ||
|
||
package problems; | ||
|
||
public class Pattern04 { | ||
|
||
public static void main(String[] args) { | ||
int rows = 4; | ||
|
||
for (int i = rows; i >= 1; 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,28 @@ | ||
/*Print the following pattern: Inverted Half Peramid | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
*/ | ||
|
||
package problems; | ||
|
||
public class Pattern05 { | ||
|
||
public static void main(String[] args) { | ||
int rows = 4; | ||
|
||
for (int i = 1; i <= rows; i++) { | ||
for (int j = 1; j <= rows - 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,26 @@ | ||
/*Print the following pattern: Inverted Half Peramid | ||
1 | ||
1 2 | ||
1 2 3 | ||
1 2 3 4 | ||
1 2 3 4 5 | ||
*/ | ||
|
||
package problems; | ||
|
||
public class Pattern06 { | ||
|
||
public static void main(String[] args) { | ||
int rows = 5; | ||
|
||
for (int i = 1; i <= rows; i++) { | ||
for (int j = 1; j <= i; j++) { | ||
System.out.print(j + " "); | ||
} | ||
System.out.println(); | ||
} | ||
} | ||
|
||
} |