evgeni_tsn

Untitled

Nov 13th, 2015
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <string>
  4.  
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. int main()
  10. {
  11.     int n;
  12.     cin>>n;
  13.     int m;
  14.     cin>>m;
  15.     int matrix [n][m];
  16.     for(int red = 0; red<n; red++)
  17.     {
  18.         for(int kolona = 0; kolona<m; kolona++){
  19.             cin>>matrix[red][kolona];
  20.         }
  21.     }
  22.     for(int red = 0; red<n; red++)
  23.     {
  24.         int sumaNaRedove = 0;
  25.         for(int kolona = 0; kolona<m; kolona++){
  26.             cout<<matrix[red][kolona];
  27.             if(matrix[red][kolona]%2!=0)
  28.             {
  29.             sumaNaRedove = sumaNaRedove + matrix[red][kolona];             
  30.             }
  31.         }
  32.         cout<<" - sumata na nechetnite elementi ot red "<<red<<" e "<<sumaNaRedove<<endl;
  33.     }  
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment