-
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
8444f8c
commit e124498
Showing
3 changed files
with
89 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,29 @@ | ||
/*Print the following pattern: Solid Rectangle | ||
* * * * * | ||
* * * * * | ||
* * * * * | ||
* * * * * | ||
*/ | ||
|
||
package problems; | ||
|
||
class Pattern01 { | ||
|
||
public static void main(String args[]) { | ||
|
||
int rows = 4; | ||
int columns = 5; | ||
|
||
for (int i = 1; i <= rows; i++) { | ||
|
||
for (int j = 1; j <= columns; 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,30 @@ | ||
/*Print the following pattern: Hollow Rectangle | ||
* * * * * | ||
* * | ||
* * | ||
* * * * * | ||
*/ | ||
|
||
package problems; | ||
|
||
public class Pattern02 { | ||
|
||
public static void main(String[] args) { | ||
int rows = 4; | ||
int columns = 5; | ||
|
||
for (int i = 1; i <= rows; i++) { | ||
for (int j = 1; j <= columns; j++) { | ||
if (i == 1 || j == 1 || i == rows || j == columns) { | ||
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,30 @@ | ||
/*Print the following pattern: Hollow Rectangle | ||
* | ||
* * | ||
* * * | ||
* * * * | ||
*/ | ||
|
||
package problems; | ||
|
||
public class Pattern03 { | ||
|
||
public static void main(String[] args) { | ||
int rows = 4; | ||
int columns = 4; | ||
|
||
for (int i = 1; i <= rows; i++) { | ||
|
||
for (int j = 1; j <= i; j++) { | ||
|
||
System.out.print("* "); | ||
|
||
} | ||
|
||
System.out.println(); | ||
} | ||
} | ||
|
||
} |