Program No : 31 :

Write a program in C to read and display a 3 x 3 Matrix ?

            program no  :31
 purpose : read and print a 3 x 3 matrix.

#include<"stdio.h">
#include<"conio.h">

main ()
{
	
	int a[3][3];

	readmatrix(a);

	printmatrix(a);

	getch();

}

readmatrix(m)
int m[][3]
{
	int i, j;

	for(i=0;i<3;i++)
		for (j=0; j<3;j++)

			scanf("%d", &m[i][j]);
}

printmatrix(m)
int m[][3];
{
	int i,j;
	for(i=0;i<3;i++)
	{
		for (j=0; j<3;j++)
			printf("%d  ", m[i][j]);
		printf("\n");

	}
}  
Back