Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main {
- public static void main(String[] args) {
- for(int i=0; i<5; i++){
- for(int j=0; j<5; j++){
- if(i==j || j==0 || i==4) System.out.print("*");
- else System.out.print(" ");
- }
- System.out.println();
- }
- }
- }
- /*
- i\j| 0 | 1 | 2 | 3 | 4 |
- 0 | | | | | |
- ----+---+---+---+---+---|
- 1 | | | | | |
- ----+---+---+---+---+---|
- 2 | | | | | |
- ----+---+---+---+---+---|
- 3 | | | | | |
- ----+---+---+---+---+---|
- 4 | | | | | |
- ----+---+---+---+---+---|
- */
Advertisement
Add Comment
Please, Sign In to add comment