-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoundary.java
More file actions
33 lines (33 loc) · 925 Bytes
/
Boundary.java
File metadata and controls
33 lines (33 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.util.*;
public class Boundary
{
public static void main(String[] args)
{
System.out.println("BOUNDARY");
Scanner sc=new Scanner(System.in);
System.out.print("No. of Rows [int]->");
int m=sc.nextInt();
System.out.print("No. of Columns [int]->");
int n=sc.nextInt();
int[][] dda=new int[m][n];
for(int i=0;i<m;i++)
{
for(int j=0;j<n;j++)
{
System.out.print("Element ["+(i+1)+"x"+(j+1)+"] [int]->");
dda[i][j]=sc.nextInt();
}
}
for(int i=0;i<m;i++)
{
System.out.print("\n|");
for(int j=0;j<n;j++)
{
if(i==0 || j==0 || i==(m-1) || j==(n-1))
System.out.print(dda[i][j]+"|");
else
System.out.print(" "+"|");
}
}
}
}