1#include<stdio.h>
2int main(){
3 /* 2D array declaration*/
4 int disp[2][3];
5 /*Counter variables for the loop*/
6 int i, j;
7 for(i=0; i<2; i++) {
8 for(j=0;j<3;j++) {
9 printf("Enter value for disp[%d][%d]:", i, j);
10 scanf("%d", &disp[i][j]);
11 }
12 }
13 //Displaying array elements
14 printf("Two Dimensional array elements:\n");
15 for(i=0; i<2; i++) {
16 for(j=0;j<3;j++) {
17 printf("%d ", disp[i][j]);
18 if(j==2){
19 printf("\n");
20 }
21 }
22 }
23 return 0;
24}
1#include <stdio.h>
2
3int main(){
4
5 printf("Enter the number of columns");
6 int i;
7 scanf("%d", &i);
8 printf("Enter the number of rows");
9 int y;
10 scanf("%d", &y);
11
12 int r[i][y];
13 int a;
14 int b;
15
16 for (a=0; a<i; a++){
17 for (b=0; b<y; b++){
18 scanf("%d",&r[a][b]);
19 }
20 }
21}
22