Here is the program for transpose of the grid in C.

We initially read a grid of size mxn and afterwards discover its transpose by simply exchanging the lines and segments for example lines become segments and segments become rows.rows of segments of the second lattice.

```
#include<stdio.h>
int main()
{
int a[5][5],i,j,m,n;
printf("How many rows?");
scanf("%d",&n);
printf("How many columns?");
scanf("%d",&m);
printf("\nEnter the matrix:\n");
for(i=0;i<m;++i)
for(j=0;j<n;++j)
scanf("%d",&a[i][j]);
printf("\nTranspose of given matrix:\n");
for(i=0;i<m;++i)
{
for(j=0;j<n;++j)
printf("%d ",a[j][i]);
printf("\n");
}
return 0;
}
```

**Output**

```
How many rows?3
How many columns?3
Enter the matrix:
1 2 3
4 5 6
7 8 9
Transpose of given matrix:
1 4 7
2 5 8
3 6 9
```