Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- class Solution{
- public static void main(String args[]) {
- Scanner in = new Scanner(System.in);
- int N = in.nextInt();
- char[][] mat = new char[N][N];
- for(int i = 0; i < N; i++)
- for(int j = 0; j < N; j++)
- mat[i][j] = ' ';
- for(int i = 0; i < N; i++)
- {
- mat[i][0]='#';
- mat[0][i]='#';
- mat[N-1][i]='#';
- mat[i][N-1]='#';
- }
- for(int i = 0; i < N; i++)
- {
- for(int j = 0; j < N; j++)
- System.out.print(mat[i][j]);
- System.out.println();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement