2-DIMENSIONAL ARRAY
import java.util.Scanner;
class t2darray
{
public static void main()
{
int row,coloum=0;
Scanner sc = new Scanner(System.in);
System.out.println("Enter the size of row : ");
row=sc.nextInt();
System.out.println("Enter the size of coloum : ");
coloum=sc.nextInt();
int a [][]= new int [row][coloum];
for (int i=0;i<row;i++)
{
for (int j=0;j<coloum;j++)
{
System.out.println("Enter the value : ");
a[i][j]=sc.nextInt();
}
}
for(int i=0;i<row;i++)
{
for(int j=0;j<coloum;j++)
{
System.out.print(a[i][j]+"\t");
}
System.out.println();
}
}
}
0 Comments