Advertisement
Josif_tepe

Untitled

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