Write a program to accept and display the elements of 2d array

//this is a program to accept and display the elements of 2d array
#include<stdio.h>
#include<conio.h>
void main()
{
int a[2][2],i,j;

printf("\n\nEnter the elements of 2-d array: ");

for(i=0;i<2;i++)
{
for(j=0;j<2;j++)
{
printf("\n\nEnter Any number: ");
scanf("%d",&a[i][j]);
}
}

printf("\n\nDisplaying the elements of array: ");

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

getch();
}


Previous
Next Post »