package Mobile.Arrays;
import java.util.Scanner;
public class Array2D_Matrix
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int a[][]=new int[10][10];
System.out.println("Rows");
int r=sc.nextInt();
System.out.println("Columns");
int c=sc.nextInt();
System.out.println("Enter elements");
for(int i=1;i<=r;i++)
{
for(int j=1;j<=c;j++)
{
a[i][j]=sc.nextInt();
}
}
System.out.println("Entered elements are");
for(int i=1;i<=r;i++)
{
for(int j=1;j<=c;j++)
{
System.out.print("\t"+a[i][j]);
}
System.out.print("\n");
}
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.