C program to take elements of Matrix 3x3 and find transpose of matrix.|C |languagecopy.blogspot.com|

Question:

Write a Program in C to take elements of a matrix[3][3] and find the transpose of matrix.

Source Code:

#include<stdio.h> int main() { int mat[3][3],i,j; printf("Enter the elements of matrix 3X3\n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { scanf("%d",&mat[i][j]); } } printf("Original Mtrix is:\n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("%d \t",mat[i][j]); } printf("\n"); } printf("Transpoose of Mtrix is:\n"); for(i=0;i<3;i++) { for(j=0;j<3;j++) { printf("%d \t",mat[j][i]); } printf("\n"); } return 0; }

Output:

Enter the elements of matrix 3X3 Original Mtrix is: 1 2 3 4 5 6 7 8 9 Transpose of Mtrix is: 1 4 7 2 5 8 3 6 9

Comments

Popular posts from this blog

Introduction to Python.

Decision Making Statement.