Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int n, m;
- scanf("%d%d", &n, &m);
- int mat[n][m];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- scanf("%d", &mat[i][j]);
- }
- }
- float sredna_vrednost = 0.0;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- sredna_vrednost += mat[i][j];
- }
- }
- sredna_vrednost /= (n * m);
- printf("Sredna vrednost: %f\n", sredna_vrednost);
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < m; j++) {
- if((float)mat[i][j] > sredna_vrednost) {
- printf("%d ", mat[i][j]);
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment