Facebook
Banner
XMPP JavaScript Library READ MORE

Program to calculate transpose of a matrix


1 #include <stdio.h>
2 #include <conio.h>
3 void main()
4 {
5 int matrix[3][3];
6 //Read the matrix
7 int i,j;
8 for (i=0; i<3; i++)
9 {
10 for(j=0; j<3; j++)
11 {
12 printf("Enter element %d of %d: ",i,j);
13 scanf("%d",&matrix[i][j]);
14 }
15 }
16
17 //Print Normal matrix
18 printf("Real Matrix is:-\n");
19 for (i=0; i<3; i++)
20 {
21 for(j=0; j<3; j++)
22 {
23 printf("\t%d",matrix[i][j]);
24 }
25 printf("\n");
26 }
27 printf("\n");
28
29 //Print Transposed matrix
30 printf("Transposed Matrix is:-\n");
31 for (i=0; i<3; i++)
32 {
33 for(j=0; j<3; j++)
34 {
35 printf("\t%d",matrix[j][i]);
36 }
37 printf("\n");
38 }
39 getch();
40 }
41
Add Your Comment
   
    Yes! I want to receive all comments by email

  by Sanjay on 24-Apr-2013 12:32 am
Thanks dude
  • Reply
  •  0 Like
  •  0 Dislike
  • Report
  by jagadeesh on 21-Mar-2012 02:28 pm
Is there any algorithm available for this program...?
  • Reply
  •  1 Like
  •  1 Dislike
  • Report