Untitled
unknown
plain_text
2 years ago
638 B
6
Indexable
#include <stdio.h>
int main() {
int M, N;
printf("Enter the number of rows (M): ");
scanf("%d", &M);
printf("Enter the number of columns (N): ");
scanf("%d", &N);
int matrix[M][N];
printf("Enter the elements of the matrix:\n");
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
scanf("%d", &matrix[i][j]);
}
}
printf("Elements in rows with even numbers:\n");
for (int i = 1; i < M; i += 2) {
for (int j = 0; j < N; j++) {
printf("%d ", matrix[i][j]);
}
printf("\n");
}
return 0;
}Editor is loading...
Leave a Comment