How to resolve the algorithm Matrix transposition step by step in the FreeBASIC programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Matrix transposition step by step in the FreeBASIC programming language

Table of Contents

Problem Statement

Transpose an arbitrarily sized rectangular Matrix.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Matrix transposition step by step in the FreeBASIC programming language

Source code in the freebasic programming language

Dim matriz(0 To 3, 0 To 4) As Integer = {{78,19,30,12,36},_
{49,10,65,42,50},_
{30,93,24,78,10},_
{39,68,27,64,29}}
Dim As Integer mtranspuesta(Lbound(matriz, 2) To Ubound(matriz, 2), Lbound(matriz, 1) To Ubound(matriz, 1))
Dim As Integer fila, columna

For fila = Lbound(matriz,1) To Ubound(matriz,1)
    For columna = Lbound(matriz,2) To Ubound(matriz,2)
        mtranspuesta(columna, fila) = matriz(fila, columna)
        Print ; matriz(fila,columna); " ";
    Next columna
    Print
Next fila
Print

For fila = Lbound(mtranspuesta,1) To Ubound(mtranspuesta,1)
    For columna = Lbound(mtranspuesta,2) To Ubound(mtranspuesta,2)
        Print ; mtranspuesta(fila,columna); " ";
    Next columna
    Print
Next fila
Sleep

  

You may also check:How to resolve the algorithm Associative array/Creation step by step in the Liberty BASIC programming language
You may also check:How to resolve the algorithm FASTA format step by step in the Clojure programming language
You may also check:How to resolve the algorithm String concatenation step by step in the Mathcad programming language
You may also check:How to resolve the algorithm Comments step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Isqrt (integer square root) of X step by step in the 11l programming language