Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class SquareFrame_04 {
- public static void main(String[] args) {
- Scanner scan = new Scanner(System.in);
- int n = Integer.parseInt(scan.nextLine());
- for (int i = 1; i <= 1; i++) {
- System.out.print("+");
- for (int j = 0; j < n - 2; j++) {
- System.out.print(" -");
- }
- for (int k = 0; k < 1; k++) {
- System.out.print(" +");
- }
- }
- System.out.println();
- for (int j = 0; j < n - 2; j++) {
- for (int k = 0; k < 1; k++) {
- System.out.print("|");
- }
- for (int l = 1; l <= n - 2; l++) {
- System.out.print(" -");
- }
- for (int k = 0; k < 1; k++) {
- System.out.print(" |");
- }
- System.out.println();
- }
- System.out.print("+");
- for (int j = 1; j <= n - 2; j++) {
- System.out.print(" -");
- }
- for (int k = 0; k < 1; k++) {
- System.out.print(" +");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement