Menus

Wednesday 22 April 2020

C program to print two dimensional array





#include<stdio.h>

void main()
{

int a[10][10],i,j,m,n;

printf("Enter size of rows and columns of array : ");
scanf("%d%d",&m,&n);

printf("Enter elements in the array :");

for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
  printf("a[%d][%d] = ",i,j);
  scanf("%d",&a[i][j]);
}
}


printf("Array elements \n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
  printf(" %d",a[i][j]);
}
printf("\n");
}


}




No comments:

Post a Comment