Search
 
SCRIPT & CODE EXAMPLE
 

C

transpose of matrix using c program

#include<stdio.h>
int main()
{
  int n,m,a[100][100],i,j;
  printf("Enter row and col:");
  scanf("%d%d",&n,&m);
  printf("Matrix A :
");
  for(i=0;i<n;i++)
    {
      for(j=0;j<m;j++)
        {
          printf("a[%d][%d] :",i,j);
          scanf("%d",&a[i][j]);
        }
    }

  printf("Transpose of Matrix :
");
  for(i=0;i<n;i++)
    {
      for(j=0;j<m;j++)
        {
          printf("%d 	",a[j][i]);
        }
      printf("
");
    }
  
}
Comment

transpose of matrix using c

#include<stdio.h>
void main(){
    int row,column,i,j,mat[100][100],tra[100][100];

    printf("Enter number of rows of matrix : ");
    scanf("%d",&row);
    printf("Enter number of columns of matrix : ");
    scanf("%d",&column);
    
    printf("#### Matrix ####
");
    for(i=0;i<row;i++){
        for(j=0;j<column;j++){
            printf("Enter element a %d%d : ",i+1,j+1);
            scanf("%d",&mat[i][j]);
        }
    }

    for(i=0;i<row;i++){
        for(j=0;j<column;j++){
            tra[i][j] = mat[j][i];
        }
    }
    
    for(i=0;i<row;i++){
        for(j=0;j<column;j++){
            printf("%d ",tra[i][j]);
        }
        printf("
");
    }
    
}
Comment

PREVIOUS NEXT
Code Example
C :: changing an item in an array in c 
C :: else if statement in c 
C :: c program structure 
C :: c arrays 
C :: youtube code 
C :: tableau c 
C :: write to console c 
C :: C Program to calculate the total execution time of a program 
C :: how can i show ant text by onclick 
Dart :: flutter remove debug badge 
Dart :: navigator.pushandremoveuntil flutter 
Dart :: button shape flutter 
Dart :: flutter textinput number 
Dart :: reverse srring in dart 
Dart :: dart log to console 
Dart :: undeline to text in flutter 
Dart :: file picker flutter file size 
Dart :: print variable types in flutter 
Dart :: ce button on calculator dart 
Dart :: cannot add to a fixed-length list 
Dart :: dart move item in list 
Dart :: underscore dart 
Dart :: six_ft_apart 
Dart :: dart utf-16 
Dart :: math.round dart 
Dart :: flutter chip 
Dart :: flutter add text on image 
Dart :: online dart compiler 
Dart :: flutter int max value 
Dart :: ink image clip flutter 
ADD CONTENT
Topic
Content
Source link
Name
4+1 =