Write a program to print a matrix.

#include<stdio.h>
#include<conio.h>
int main()
{
int matrix[3][3],c,r;
for(c=0;c<3;c++)
{printf(“enbter values\n”);
for(r=0;r<3;r++)
scanf(“%d”,&matrix[r][c]);
}
for(c=0;c<3;c++)
{
for(r=0;r<3;r++)
{
printf(“%d\t”,matrix[r][c]);
}
printf(“\n”);
}
getch();
}

 

<—–End—–>

Output will be :

enter values:

3

4

5

enter values:

6

7

8

enter values:

9

10

11

3          4        5

6          7        8

9         10        11