View Code of Problem 45

#include<stdio.h>
void main()
{
    int n, i=0, j=0, temp;
    scanf("%d", &n);
    int jz[n][n];

    while(i<n)
    {
        for(j=0; j<n; j++)
            scanf("%d", &jz[i][j]);
        i++;
    }
    for(i=0; i<n; i++)
    {
        for(j=i+1; j<n; j++)
        {
            temp = jz[i][j];
            jz[i][j] = jz[j][i];
            jz[j][i] = temp;
        }
    }
    for(i=0; i<n; i++)
    {
        for(j=0; j<n; j++)
            printf("%d ", jz[i][j]);
        printf("\n");
    }

}

Double click to view unformatted code.


Back to problem 45