andari3107

Loop

Nov 13th, 2018
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.34 KB | None | 0 0
  1. public class NestedLoop {
  2.     public static void main(String[] args) {
  3.        
  4.         for (int x=1; x<=5; x++) {
  5.            
  6.             for (int y=1; y<=6; y++) {
  7.                
  8.                 if (x==1||x==5||y==1||y==6) {
  9.                     System.out.print("*");
  10.                 }
  11.                 else {
  12.                     System.out.print(" ");
  13.                 }
  14.                
  15.             }
  16.             System.out.println();
  17.         }
  18.         System.out.println("andari");
  19.     }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment