Professional Documents
Culture Documents
(10) Написати програм којим се уносе вредности квадратне матрице максималне димензије 10
и потом се пребројава и исписује колико има позитивних елемената на споредној дијагонали и
испод главне дијагонале. Користити функције.
#include <stdio.h>
#define DIM 10
void UnosMat(int mat[][DIM], int m, int n) {
printf("Unesi elemente matrice:\n");
int i, j;
for (i = 0; i < m; i++) {
for (j = 0; j < n; j++) {
printf("mat[%d][%d] = ", i, j);
scanf("%d", &mat[i][j]);
}
}
}
}
}
return br;
}
void main() {
int mat[DIM][DIM];
int n, br;
printf("Unesi dimenziju kvadratne matrice: ");
scanf("%d", &n);
UnosMat(mat, n, n);
IspisMat(mat, n, n);
br = FunkBrPozGDiSD(mat, n);
printf("Broj pozitivnih elemenata na glavnoj dijagonali ili ispod sporedne dijagonale
je %d", br);
//Ne mora
getchar();
getchar();