Monday, 4 May 2020

Reading and displaying the elements of two dimensional array

Reading and displaying the elements of two dimensional array



#include< stdio.h >
void main(){
int array1[10][10], i,  j, n, m;

// reading the size of array

printf(" enter the size of array <10");
scanf("%d%d", &n, &m) ;



 
    // reading the elements of array
    printf(" enter elements of first matrix ");
    for( i=0; i<n ;i++){
        for(j=0; j<m; j++){
            scanf( "%d", &array1[i][j]);
        }
    }


    // Printing the elements of array
    printf(" entered  elements of  array  are \n");
    for( i=0; i<n ;i++){
        for(j=0; j<m; j++){
            printf( "%d  ", array1[i][j]);
        }
      printf("   \n ");
    }
}

No comments:

Post a Comment