Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class NestedLoop {
- public static void main(String[] args) {
- for(int y = 1; y <= 9; y++) {
- for(int x = 1; x <= 9; x++) {
- if(x == y) {
- System.out.print("* ");
- }
- else if(x == 10 - y) {
- System.out.print("* ");
- }
- else if(x == 5) {
- System.out.print("* ");
- }
- else if(y == 5) {
- System.out.print("* ");
- }
- else {
- System.out.print(" ");
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement