Josif_tepe

Untitled

Aug 18th, 2025
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main() {
  4.     int n, m;
  5.     scanf("%d%d", &n, &m);
  6.    
  7.     int mat[n][m];
  8.     for(int i = 0; i < n; i++) {
  9.         for(int j = 0; j < m; j++) {
  10.             scanf("%d", &mat[i][j]);
  11.         }
  12.     }
  13.    
  14.     float sredna_vrednost = 0.0;
  15.    
  16.     for(int i = 0; i < n; i++) {
  17.         for(int j = 0; j < m; j++) {
  18.             sredna_vrednost += mat[i][j];
  19.         }
  20.     }
  21.     sredna_vrednost /= (n * m);
  22.    
  23.     printf("Sredna vrednost: %f\n", sredna_vrednost);
  24.    
  25.     for(int i = 0; i < n; i++) {
  26.         for(int j = 0; j < m; j++) {
  27.             if((float)mat[i][j] > sredna_vrednost) {
  28.                 printf("%d ", mat[i][j]);
  29.             }
  30.         }
  31.     }
  32.    
  33.     return 0;
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment