import java.io.*;
class TransMatrix
{
public static void main(String args[])
{
int a[][] = new int[2][3];
int b[][]= new int[3][2];
int i,j;
DataInputStream r = new DataInputStream(System.in);
try
{
System.out.println("Enter the Matrix values");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
a[i][j]=Integer.parseInt(r.readLine());
}
}
System.out.println("Matrix is :");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
System.out.print(" "+a[i][j]);
}
System.out.println();
}
System.out.println("After the Transport of Matrix");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
b[i][j]=a[j][i];
System.out.print(" "+b[i][j]);
}
System.out.println();
}
}
catch(Exception e)
{
}
}
}
class TransMatrix
{
public static void main(String args[])
{
int a[][] = new int[2][3];
int b[][]= new int[3][2];
int i,j;
DataInputStream r = new DataInputStream(System.in);
try
{
System.out.println("Enter the Matrix values");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
a[i][j]=Integer.parseInt(r.readLine());
}
}
System.out.println("Matrix is :");
for(i=0;i<2;i++)
{
for(j=0;j<3;j++)
{
System.out.print(" "+a[i][j]);
}
System.out.println();
}
System.out.println("After the Transport of Matrix");
for(i=0;i<3;i++)
{
for(j=0;j<2;j++)
{
b[i][j]=a[j][i];
System.out.print(" "+b[i][j]);
}
System.out.println();
}
}
catch(Exception e)
{
}
}
}
No comments:
Post a Comment