Advertisement
STANAANDREY

sb prog 8

Feb 23rd, 2022
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. using namespace std;
  4. ifstream fin("Matrice.in");
  5. ofstream fout("Impar.out");
  6.  
  7. int main() {
  8.     int n, m;
  9.     fin >> n >> m;
  10.     int a[n][m];
  11.     for (int i = 0; i < n; i++) {
  12.         for (int j = 0; j < m; j++) {
  13.             fin >> a[i][j];
  14.         }
  15.     }
  16.  
  17.     for (int j = 0; j < m; j++) {
  18.         int nr = 0;
  19.         for (int i = 0; i < n; i++) {
  20.             nr += a[i][j] % 2;
  21.         }
  22.         fout << nr << endl;
  23.     }
  24.  
  25.     return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement