Untitled
unknown
plain_text
2 years ago
914 B
10
Indexable
#include <stdio.h>
int main() {
int M, N;
printf("13 практическая, 10 задача\n-----------------\n");
printf("Введите размер M: ");
scanf("%d", &M);
printf("Введите размер N: ");
scanf("%d", &N);
int matrix[M][N];
printf("Введите элементы матрицы:\n");
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
scanf("%d", &matrix[i][j]);
}
}
int columnProducts[N];
for (int j = 0; j < N; j++) {
columnProducts[j] = 1;
}
for (int j = 0; j < N; j++) {
for (int i = 0; i < M; i++) {
columnProducts[j] *= matrix[i][j];
}
}
printf("Произведение элементов каждого столбца:\n");
for (int j = 0; j < N; j++) {
printf("%d ", columnProducts[j]);
}
printf("\n");
return 0;
}Editor is loading...
Leave a Comment