How to print your 2D array?

Below  code will help you to print matrix in array

#include<stdio.h>
#include<conio.h>
void main ()
{
int a[2][2],i,j;
clrscr();
printf(“Enter number for matrix\n”);
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
scanf(“%d”,&a[i][j]);
}
}
printf(“Your matrix is here:-\n”);
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf(“%d\t”,a[i][j]);
}
printf(“\n”);
}
getch();
}

After running above program:-

Leave a Reply