Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class pattern {
- public static void main(String[] args) {
- Scanner keyboard = new Scanner(System.in);
- System.out.print("Enter size: ");
- int s = keyboard.nextInt();
- for (int i = 1; i <= s; i++) {
- for (int j = 1; j <= s; j++) {
- if ((i == 1 || i == s) || (j == 1 || j == s)){
- System.out.print("*");
- }else {
- System.out.print(" ");
- }
- }
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement