C program to display elements of 2d array
# include<stdio.h> void main( ) { int i,j; int a[3][3] = { { 1,2,3}, {4,5,6}, {7,8,9}}; printf("elements of an array \n \n"); for( i=0; i<3; i++) { for ( j=0; j<3; j++) { printf ("%d\t", a[i ][ j ]); } // end of inner for loop printf("\n"); } // end of outer for loop } // end of main() function
Output:
Share: