/*program for two dimensional matrix */
package array;
import java.util.Scanner;
class ArrayClass3
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int[][]ar=new int[2][2];
int i,j;
System.out.println("Enter elements of the array :");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
ar[i][j]=s.nextInt();
}
}
System.out.println("Two dimension matrix are are : ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
System.out.print(ar[i][j]+" ");
}
System.out.println();
}
}
}
import java.util.Scanner;
class ArrayClass3
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
int[][]ar=new int[2][2];
int i,j;
System.out.println("Enter elements of the array :");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
ar[i][j]=s.nextInt();
}
}
System.out.println("Two dimension matrix are are : ");
for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
System.out.print(ar[i][j]+" ");
}
System.out.println();
}
}
}
output
No comments:
Post a Comment