Advertisement
veronikaaa86

Square Of Stars1

Jan 10th, 2018
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class SquareOfStars2 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         int n = Integer.parseInt(scanner.nextLine());
  8.  
  9.         String star = "*";
  10.         for (int col = 0; col < 1; col++) {
  11.             for (int row = 0; row < n; row++) {
  12.                 System.out.print(star);
  13.             }
  14.             System.out.println();
  15.         }
  16.         for (int i = 0; i < n - 2; i++) {
  17.             System.out.print(star);
  18.             for (int j = 0; j < n - 2; j++) {
  19.                 System.out.print(" ");
  20.             }
  21.             System.out.println(star);
  22.         }
  23.         for (int col = 0; col < 1; col++) {
  24.             for (int row = 0; row < n; row++) {
  25.                 System.out.print(star);
  26.             }
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement