Answers for "create 2d array take input form user and write a display fuction to display in array format in c"

0

create 2d array take input form user and write a display fuction to display in array format in c

#include<stdio.h>
int main(){
   /* 2D array declaration*/
   int disp[2][3];
   /*Counter variables for the loop*/
   int i, j;
   for(i=0; i<2; i++) {
      for(j=0;j<3;j++) {
         printf("Enter value for disp[%d][%d]:", i, j);
         scanf("%d", &disp[i][j]);
      }
   }
   //Displaying array elements
   printf("Two Dimensional array elements:\n");
   for(i=0; i<2; i++) {
      for(j=0;j<3;j++) {
         printf("%d ", disp[i][j]);
         if(j==2){
            printf("\n");
         }
      }
   }
   return 0;
}
Posted by: Guest on June-17-2021

Code answers related to "create 2d array take input form user and write a display fuction to display in array format in c"

Browse Popular Code Answers by Language