index — ti25-glauchau-code @ master

Meine Lösungen (oder auch nicht) für die Programmieraufgaben in der TI25 an der Staatlichen Studienakademie Glauchau

gpt/2025-11-07/transponieren.c (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
#include <stdio.h>

int main()
{
    int m = 2, n = 3;

    int a[2][3] = {{1, 2, 3}, {4, 5, 6}};

    int t[3][2];

    // Find transpose
    for (int i = 0; i < m; i++)
    {
        for (int j = 0; j < n; j++)
        {
            t[j][i] = a[i][j];
        }
    }

    // Display transpose
    printf("Transpose of the matrix:\n");
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            printf("%d ", t[i][j]);
        }
        printf("\n");
    }

    return 0;
}