Program:
#include<stdio.h>
int main(){
int i,j,a[50][50],x,y;
//enter the limit of the array
printf("enter the limit:");
scanf("%d%d",&x,&y);
//enter the numbers to the array
printf("enter the numbers:");
for(i=0;i<x;i++)
{
for(j=0;j<y;j++)
{
scanf("%d",&a[i][j]);
}
}
//display the array
printf("the array is:");
for(i=0;i<x;i++){
for(j=0;j<y;j++){
printf("\na[%d][%d] : %d ",i,j,a[i][j]);
}
}
return 0;
}
OUTPUT
enter the limit:5
2
enter the numbers:0
0
1
2
2
4
3
6
4
8
the array is:
a[0][0] : 0
a[0][1] : 0
a[1][0] : 1
a[1][1] : 2
a[2][0] : 2
a[2][1] : 4
a[3][0] : 3
a[3][1] : 6
a[4][0] : 4
a[4][1] : 8
0 Comments