Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class PrintSquare
- {
- public static void print(int count)
- {
- for (int row = 0; row < count; row++) {
- for (int col = 0; col < count; col++) {
- System.out.print("*");
- }
- System.out.println();
- }
- }
- public static void main(String[] args)
- {
- Scanner in = new Scanner(System.in);
- int count = in.nextInt();
- while (count > 1 && count <= 30) {
- print(count);
- count = in.nextInt();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement