1#include<stdio.h>
2#define n 3
3int main()
4{
5int a[n][n],b[n*n],c[n*n],i,j,k=0,l=0;
6printf(“\n Enter elements of 2D array : “);
7for(i=0;i<n;i++)
8{
9for(j=0;j<n;j++)
10{
11scanf(“%d”,&a[i][j]);
12}
13}
14printf(“\n Given 2D array : \n“);
15for(i=0;i<n;i++)
16{
17for(j=0;j<n;j++)
18{
19printf(“%d ”,a[i][j]);
20}
21printf(“\n”);
22}
23printf(“\n Row wise \n”);
24for(i=0;i<n;i++)
25{
26for(j=0;j<n;j++)
27{
28b[k]=a[i][j];
29k++;
30}
31}
32printf(“\n Column wise \n”);
33for(i=0;i<n;i++)
34{
35for(j=0;j<n;j++)
36{
37c[l]=a[j][i];
38l++;
39}
40}
41}