Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transpose of a Matrix #29

Open
sujana-kamasany opened this issue Feb 8, 2022 · 6 comments
Open

Transpose of a Matrix #29

sujana-kamasany opened this issue Feb 8, 2022 · 6 comments
Labels
good first issue Good for newcomers Hacktoberfest-Accepted Make your Pull Request for Hacktoberfest 2023 Java Basic Java Programs

Comments

@sujana-kamasany
Copy link
Owner

Java Program to Find Transpose of a Matrix

@sujana-kamasany sujana-kamasany added good first issue Good for newcomers Java Basic Java Programs and removed good first issue Good for newcomers labels Feb 8, 2022
@DHARUNKUMAR7
Copy link
Contributor

My sol:
public static void main(String[] args) throws Exception {
Scanner in = new Scanner(System.in);
int n = in.nextInt();
int m = in.nextInt();
int[][] arr = new int[n][m];
// Initializing a 2d array
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
arr[i][j] = in.nextInt();
}
}
//Main operation.
for(int i = 0 ; i < n; i++){
for(int j = i ; j < m ; j++){
if(i != j){
int temp = arr[i][j];
arr[i][j] = arr[j][i];
arr[j][i] = temp;
}
}
}
System.out.println(Arrays.deepToString(arr));
}

@sujana-kamasany
Copy link
Owner Author

@DHARUNKUMAR7 Thank you for your solution ! Please go ahead and make a pull request

@matteopagano
Copy link

Look at my repo Matrix, is an API in java language for work with matrixes.

@sujana-kamasany
Copy link
Owner Author

Look at my repo Matrix, is an API in java language for work with matrixes.

@matteopagano sure ! Thanks for sharing this

@sujana-kamasany sujana-kamasany added the Hacktoberfest-Accepted Make your Pull Request for Hacktoberfest 2023 label Oct 5, 2023
@kashish-51
Copy link
Contributor

Hey, I want to work on this please assign me

@sujana-kamasany
Copy link
Owner Author

Hey, I want to work on this please assign me

Sure ! Please submit your solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Hacktoberfest-Accepted Make your Pull Request for Hacktoberfest 2023 Java Basic Java Programs
Projects
None yet
Development

No branches or pull requests

4 participants