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 a matrix in 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 :: Invalid public key for CUDA apt repository 
C :: zizag c 
C :: variably modified ‘_memory’ at file scope 
C :: golden cobblestone modpack 
C :: same project on different monitor in intellij mac 
C :: roshan kumar 
C :: octave sum all elements in matrix 
C :: prime chec kin c 
C :: How to generate a random array in c 
C :: c get random float 
C :: for loop c 
C :: determination of armstrong number in c 
C :: srand time null 
C :: if statement c short form 
C :: c output 
C :: round function in c 
C :: c program to find minimum of 4 numbers using conditional operator in c 
C :: how make a character in c scanf 
C :: array value from user c 
C :: extract substring after certain character in flutter 
C :: stack push code 
C :: compare c strings 
C :: How to convert string to int without using library functions in c 
C :: how to take blank space in c scanf 
C :: identifiers in c 
C :: Installing Tailwind 
C :: c linked list 
C :: how to insert elements in and array and print it in c 
C :: how to check the word is present in given char array in c 
C :: What should main() return in C? 
ADD CONTENT
Topic
Content
Source link
Name
6+8 =