Pages

E-mail us at prgms4starters@gmail.com for any queries or to share your programs. Please mention the program definition in the subject line.

In case you need help in finishing a program, do mention "incomplete pgm" in the subject line. Our team of experts will do their best to help you.

Click the link to follow this page for updates and reminders: FOLLOW THIS SITE

You can also visit our Facebook page by clicking HERE

**don't forget to participate in the polls at the bottom of the page

Monday, November 8, 2010

c program to find the transpose of a matrix and find the product of the transpose and the original matrix

#include<stdio.h>

int main()
{

int A[10][10],B[10][10],C[10][10],i,j,k,n,ch=1;

while(ch==1)
{
printf("Matrix\n");
printf("To find transpose and multiply with the original matrix:\n");

printf("Enter the limit of the matrix:\n");
scanf("%d",&n);
printf("\n");
printf("Enter the elements of matrix A:\n");

for(i=0;i<n;i++)

{
for(j=0;j<n;j++)

{
scanf("%d",&A[i][j]);

}
}

printf("\nThe original matrix A:\n");

for(i=0;i<n;i++)

{
for(j=0;j<n;j++)
{
printf("%d\t",A[i][j]);
}
printf("\n");

}

printf("\nThe transpose matrix :\n");

for(i=0;i<n;i++)

{
for(j=0;j<n;j++)

{
B[i][j]=A[j][i];
printf("%d\t",B[i][j]);
}
printf("\n");
}
for(i=0;i<n;i++)

{
for(j=0;j<n;j++)

{
C[i][j]=0;
for(k=0;k<n;k++)
{
C[i][j]+=(A[i][k]*B[k][j]);
}
}
}

printf("\nThe multiplied matrix:\n");

for(i=0;i<n;i++)

{
for(j=0;j<n;j++)

{
printf("%d\t",C[i][j]);
}

printf("\n");
}
printf("\nEnter 1 to continue and 0 to exit:");
scanf("%d",&ch);

}
}

No comments:

Post a Comment

We have noticed that 20% of our visitors are still using internet explorer. For a better and faster surfing experience we recommend that you switch to either Google Chrome or Mozilla Firefox. We cannot provide you the downloads but here are the links to sites where you can download them from

Google Chrome - click here to go to site

Mozilla Firefox - click here to go to site

Where are you from

Do you think this site was helpful

Should we put up more C or C++ programs