0

Program which accepts 2D array of integers and its size as arguments and displays the elements of middle row and middle column??

eg: if array is 3 5 4 7 6 9 2 1 8 output : middle row : 7 6 9 middle column : 5 6 1

3/26/2017 11:44:43 AM

M G

1 Answer

New Answer

+1

void printMiddle(int[][] arr, int size){ int i = 0; printf("middle row: "); for (i=0;i<size;i++){ printf("%d ", arr[size/2][i]; } printf("\nmiddle column: "); for (i=0;i<size;i++){ printf("%d ", arr[i][size/2]; } }