Skip to content

Instantly share code, notes, and snippets.

@IanCarloz
Created November 6, 2017 16:19
Show Gist options
  • Save IanCarloz/8bd79b0de4a96caaa05cf2cb227b3db8 to your computer and use it in GitHub Desktop.
Save IanCarloz/8bd79b0de4a96caaa05cf2cb227b3db8 to your computer and use it in GitHub Desktop.
#include<stdio.h>
int main(){
/* 2D array declaration*/
int disp[10][2];
/*Counter variables for the loop*/
int i, j;
for(i=0; i<10; i++) {
for(j=0;j<2;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<10; i++) {
for(j=0;j<2;j++) {
printf("%d ", disp[i][j]);
if(j==1){
printf("\n");
}
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment