Advertisement
Guest User

Untitled

a guest
Feb 19th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.51 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class PrintSquare
  4.  
  5. {
  6.  
  7.   public static void print(int count)
  8.   {
  9.     for (int row = 0; row < count; row++) {
  10.  
  11.       for (int col = 0; col < count; col++) {
  12.         System.out.print("*");
  13.       }
  14.       System.out.println();
  15.     }
  16.  
  17.   }
  18.  
  19.   public static void main(String[] args)
  20.   {
  21.  
  22.     Scanner in = new Scanner(System.in);
  23.     int count = in.nextInt();
  24.  
  25.     while (count > 1 && count <= 30) {
  26.       print(count);
  27.       count = in.nextInt();
  28.     }
  29.   }
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement