-->

## Social Items

Go Program To Find Transpose Of A Matrix (Golang) - In this post, we will learn how to create to find transpose of a matrix program in the Go programming language. Matrix is a collection of numbers arranged in rows (vertical) and columns (horizontal) can also be called two-dimensional arrays. Matrix Transpose produces a matrix by exchanging rows into columns and columns into rows of a matrix.

## Go Program To Find Transpose Of A Matrix (Golang)

### Source Code :

``````package main

import "fmt"

func main() {
var i, j, m, n int
var matrix int
var transpose int

fmt.Print("Enter the number of rows the matrix: ")
fmt.Scanln(&m)
fmt.Print("Enter the number of columns th matrix: ")
fmt.Scanln(&n)

fmt.Println("Enter the matrix elements")
for i = 0; i < m; i++ {
for j = 0; j < n; j++ {
fmt.Scan(&matrix[i][j])
}
}

for i = 0; i < m; i++ {
for j = 0; j < n; j++ {
transpose[j][i] = matrix[i][j]
}
}

fmt.Println("Transpose of matrix: ")
for i = 0; i < n; i++ {
for j = 0; j < m; j++ {
fmt.Print(transpose[i][j], "\t")
}
fmt.Println()
}
}
``````

Save the source code with the name of transpose.go, but adjust wrote with a file name that chills and don't forget the extension should .go

### Compile & Run :

Here's how to compile source code manually:
``````
\$ go build transpose.go
\$ ./transpose
``````
You can run without having to compile it:
``````
\$ go run transpose.go
``````

### The Output of Program : Picture of the result transpose matrix

### Conclusion :

From the results of the program can be run without any error and display the results matrix transpose inputted by the user. ## Go Program To Find Transpose Of A Matrix (Golang)

Go Program To Find Transpose Of A Matrix (Golang) - In this post, we will learn how to create to find transpose of a matrix program in the Go programming language. Matrix is a collection of numbers arranged in rows (vertical) and columns (horizontal) can also be called two-dimensional arrays. Matrix Transpose produces a matrix by exchanging rows into columns and columns into rows of a matrix.

## Go Program To Find Transpose Of A Matrix (Golang)

### Source Code :

``````package main

import "fmt"

func main() {
var i, j, m, n int
var matrix int
var transpose int

fmt.Print("Enter the number of rows the matrix: ")
fmt.Scanln(&m)
fmt.Print("Enter the number of columns th matrix: ")
fmt.Scanln(&n)

fmt.Println("Enter the matrix elements")
for i = 0; i < m; i++ {
for j = 0; j < n; j++ {
fmt.Scan(&matrix[i][j])
}
}

for i = 0; i < m; i++ {
for j = 0; j < n; j++ {
transpose[j][i] = matrix[i][j]
}
}

fmt.Println("Transpose of matrix: ")
for i = 0; i < n; i++ {
for j = 0; j < m; j++ {
fmt.Print(transpose[i][j], "\t")
}
fmt.Println()
}
}
``````

Save the source code with the name of transpose.go, but adjust wrote with a file name that chills and don't forget the extension should .go

### Compile & Run :

Here's how to compile source code manually:
``````
\$ go build transpose.go
\$ ./transpose
``````
You can run without having to compile it:
``````
\$ go run transpose.go
``````

### The Output of Program : Picture of the result transpose matrix

### Conclusion :

From the results of the program can be run without any error and display the results matrix transpose inputted by the user.