import java.util.Scanner;
public class TwoDArray
{
public static void main(String []args)
{
Scanner s=new Scanner(System.in);
System.out.println("Enter number of rows:");
int a=s.nextInt();
System.out.println("Enter number of colums:");
int b=s.nextInt();
int arr[][]=new int[a][b];
System.out.println("Enter numbers in Two dimentional Array:");
for(int j=0;j<arr.length;j++)
for(int i=0;i<arr.length;i++)
{
arr[i][j]=s.nextInt();
}
System.out.println("Printing");
for(int j=0;j<arr.length;j++)
for(int i=0;i<arr.length;i++)
{
System.out.println(arr[i][j]);
}
}
}
0 comments:
Post a Comment