-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharray2.java
More file actions
26 lines (26 loc) · 735 Bytes
/
array2.java
File metadata and controls
26 lines (26 loc) · 735 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
import java.util.Scanner;
class array2{
public static void main(String args[]){
//multi dimenstional array
Scanner sc=new Scanner(System.in);
int n;
System.out.println("how many rows and cols you want");
n=sc.nextInt();
int a[][]=new int[n][n];
System.out.println("enter values for array element ");
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++){
System.out.print("enter vslue for element::"+i+j);
a[i][j]=sc.nextInt();
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++){
System.out.print(a[i][j]);
}
System.out.println("\n");
}
}
}