import java.util.Scanner;
public class Array {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int a[][]=new int[2][2];
System.out.println("enter the 4 elements");
Scanner scanner=new Scanner(System.in);
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
a[i][j]=scanner.nextInt();
}
}
System.out.println("matrix");
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
System.out.print(a[i][j] +" ");
}
System.out.println();
}
int b[][]=new int[2][2];
System.out.println("enter the 4 elements");
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
b[i][j]=scanner.nextInt();
}
}
System.out.println("matrix");
for(int i=0;i<2;i++)
{
for(int j=0;j<2;j++)
{
System.out.print(b[i][j] +" ");
}
System.out.println();
}
}
}
No comments:
Post a Comment