Assigning 2d Array – C

 
#include<stdio.h>
int main()
{

 int disp[2][3];

 int i, j;

  // declaring for loop.

 for (i = 0; i < 1; i++){

  for(j = 0; j < 2; j++){

// declaring output statements.

 printf("The values are [%d][%d]", i, j );

/// declaring input statement.

 scanf("%d", &disp[i][j]);

 }

 }

 printf("Two dimensional array elements: n");


 for (i = 0; i < 1; i++){

 for(j = 0; j < 2; j++){


 printf("%d", disp[i][j]);

// declaring conditional statement.
 if (j == 2){

  printf("n"); 

 } 

   }

}

return 0; 

}

Scroll to top