Răspuns :
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("matrice.in");
int main(){
int a[100][100],n,m;
//Citeste si memoreaza matricea
f >> n >> m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
f >> a[i][j];
}
}
//Afiseaza matricea
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cout << a[i][j] << " ";
}
cout << endl;
}
//Afiseaza suma pe fiecare linie
int suma;
for(int i=0;i<n;i++){
suma=0;
for(int j=0;j<m;j++){
if(a[i][j]%2==0) suma+=a[i][j];
}
cout << suma << " ";
}
}