Pages

Get order of matrix and element from user and print matrix of given numbers and given order

Friday 19 April 2013



    # include <stdio.h>
    # include <conio.h>
    int main()
    {
      int mat[10][10] ;
      int i, j, row, col ;

      printf("Enter the order of the matrix : ") ;
      scanf("%d %d", &row, &col) ;
      printf("\nEnter the elements of the matrix : \n\n") ;
      for(i = 0 ; i < row ; i++)
        for(j = 0 ; j < col ; j++)
          scanf("%d", &mat[i][j]) ;
          printf("\nThe transpose matrix is : \n\n") ;
      for(i = 0 ; i < col ; i++)
      {
        for(j = 0 ; j < row ; j++)
        {
          printf("%d \t", mat[j][i]) ;
        }
        printf("\n") ;
      }
      getch() ;
    }

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *