Program to Accept a 2X2 Matrix in C using DS

/*WAP to accept a 2X2 matrix & display it in proper format*/
Given source code of ‘C’ program to accept a matrix of order 2X2 matrix and display the matrix in proper format. This source code is successfully compiled and executed
void main()
{
int a[3][3],i,j;
clrscr();
printf(“\n \tEnter the terms for matrix”);

for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf(“%d”,&a[i][j]);
}
}
printf(“\n The Matrix is..\n”);
for(i=0;i<3;i++)
{

for(j=0;j<3;j++)
{
printf(“%d”,a[i][j]);
}
printf(“\n”);
}
}

Leave a Reply