class
Matrix1
{
        public static void main(String args[])
throws Exception
        {
                int row,col;
                int a[][] = new int[3][3];
                int i,j;
                
BufferedReader br = new BufferedReader(new
InputStreamReader(System.in));
                System.out.print("Enter
the Row and Column Value : ");
                row =
Integer.parseInt(br.readLine());
                col = Integer.parseInt(br.readLine());
               for(i=0;i<row;i++)
                {
                        for(j=0;j<col;j++)
                        {
                               
System.out.print("Enter a[" + i + "][" + j + "]
: ");
                                a[i][j] =
Integer.parseInt(br.readLine());
                        }
                }
                System.out.println("The
Given Matrix is ");
                for(i=0;i<row;i++)
                {
                        for(j=0;j<col;j++)
                        {
                               
System.out.print(a[i][j] + "\t");
                        }
                        System.out.println();
                }
        }
}
 
No comments:
Post a Comment