0

2-D array in C

Given a 2-D, 4 x 3 array. Write a C program to change and display the largest elements in the first and third rows.

19th Nov 2022, 3:28 PM
Elvian Covalciuc
1 Réponse
0
Maybe this help you #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; }
25th Nov 2022, 2:59 PM
S3R43o3
S3R43o3 - avatar