-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArrayBoundry.java
More file actions
29 lines (28 loc) · 895 Bytes
/
ArrayBoundry.java
File metadata and controls
29 lines (28 loc) · 895 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
import java.util.*;
public class ArrayBoundry {
public static void main(String[] args) {
Scanner obj=new Scanner(System.in);
int arr[][]=new int[100][100];
System.out.print("Enter size :- ");
int n=obj.nextInt();
System.out.println("Enter Element ");
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
arr[i][j]=obj.nextInt();
}
}
System.out.println("Display boundry of Array Element :- ");
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i==0 || j==0 || i==(n-1) || j==(n-1)){
System.out.print(arr[i][j] +" ");
}
else{
System.out.print(" ");
}
}
System.out.println(" ");
}
obj.close();
}
}