///Md. Alamgir Hossain
///Dept. of Computer Science & Engineering
///Jessore University of Science & Technology
//Transpose of a Matrics in JAVA.............
package SolveProblem;
import java.util.Scanner;
public class TransposeOfaMatrics {
static Scanner myScanner=new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter the Matrics Row & Coloumn :");
int m,n;
m=myScanner.nextInt();
n=myScanner.nextInt();
System.out.println("Enter the Matrics :");
int[][] matrics=new int[10][10];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
matrics[i][j]=myScanner.nextInt();
}
}
System.out.println("Transpose of the given matrics is :");
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
System.out.print(matrics[j][i]+"\t");
}
System.out.println();
}
}
}
//Input..........2 3
// 4 5
//Output......2 4
// 3 5
///Dept. of Computer Science & Engineering
///Jessore University of Science & Technology
//Transpose of a Matrics in JAVA.............
package SolveProblem;
import java.util.Scanner;
public class TransposeOfaMatrics {
static Scanner myScanner=new Scanner(System.in);
public static void main(String[] args) {
System.out.println("Enter the Matrics Row & Coloumn :");
int m,n;
m=myScanner.nextInt();
n=myScanner.nextInt();
System.out.println("Enter the Matrics :");
int[][] matrics=new int[10][10];
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
matrics[i][j]=myScanner.nextInt();
}
}
System.out.println("Transpose of the given matrics is :");
for (int i = 0; i < m; i++) {
for (int j = 0; j < n; j++) {
System.out.print(matrics[j][i]+"\t");
}
System.out.println();
}
}
}
//Input..........2 3
// 4 5
//Output......2 4
// 3 5
No comments:
Post a Comment