## C program to transpose of matrix / A to Z Program

C program to display 3*3 matrix .

Today we will learn ” C program to transpose of matrix” . To solve this problem we should have to use different method like the use of Array, Loop. In this program we will ask user to input 3*3 matrix and transpose matrix.

Note: To understand this program you should have knowledge of C programming topics. So first visit these topics fast which make you to understand this program easy not only that your C program knowledge will also increase .

So let’s start our program. Before that let me define “Array” because this program is also related to the array.

“An array is a collection of similar data type which is store on consecutive memory location in a single variable “

Algorithm:
•     START
•  for (i=1; i<=3; i++)
• for (j=1; j<=3; j++)
• for (j=1; j<=3; j++)
•  for (i=1; i<=3; i++)
• Display “A[i][j]”
• End

Flowchart:

C Program To Display Transpose of Matrix 3*3.

`````` #include<stdio.h>
#include<conio.h>
int main ()
{
int A, i, j;
for (i=1; i<=3; i++)
{
for (j=1; j<=3; j++)
{
printf ("Enter the element of A[%d][%d]:", i, j);
scanf ("%d", &A[i][j]);
}
}
printf ("The matrix you have entered is:n");
for (i=1; i<=3; i++)
{
for (j=1; j<=3; j++)
{
printf ("%dt", A[i][j]);
}
printf ("n");
}
printf ("The transpose of above matrix is:n");
for (j=1; j<=3; j++)
{
for (i=1; i<=3; i++)
{
printf ("%dt", A[i][j]);
}
printf ("n");
}
getch ();
return 0;
}
``````

Output:

Explanation:

In the above program, we have determine 2D array of size 3*3. Then using for loop we will repeat a statement to enter element. After that, we will display the result enter by the user and then again using for loop we ill transpose array. But now we will display the element of j[], and I [ ] matrix. So which will automatically transpose a matrix .

C program to add three number using function

C program to display multiplication table using for loop.

Similar Post: 