Advertisement
Josif_tepe

Untitled

Jun 3rd, 2024
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <ctype.h>
  4.  
  5. int main() {
  6.     int n, m;
  7.     scanf("%d%d", &n, &m);
  8.  
  9.     int mat[n][m];
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             scanf("%d", &mat[i][j]);
  13.         }
  14.     }
  15.     int rezultat = 0;
  16.    for(int i = 0; i < n; i++) {
  17.     int zbir = 0;
  18.     for(int j = 0; j < m - 1; j++) {
  19.         zbir += mat[i][j];
  20.     }
  21.     if(zbir % mat[i][m - 1] == 0) {
  22.         rezultat++;
  23.         for(int j = 0; j < m; j++) {
  24.             printf("%d ", mat[i][j]);
  25.         }
  26.         printf("\n");
  27.     }
  28.    }
  29.  
  30.    if(rezultat == 0) {
  31.     printf("Ne e ispolnet nitu eden uslov\n");
  32.    }
  33.    else {
  34.     printf("Uslovot go ispolnuvaat %d\n", rezultat);
  35.    }
  36. }
  37. /*
  38. 4 4
  39. 20 1 4 5
  40. 50 0 12 11
  41. 3 2 2 7
  42. 1 11 1 2
  43.  
  44. **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement