Advertisement
STANAANDREY

sum_2mat

May 6th, 2019
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int a[100][100],b[100][100],c[100][100],n,m,i,j;
  7. cout<<"m=";cin>>m;
  8. cout<<"n=";cin>>n;
  9. for (i=0;i<m;i++)
  10.     for (j=0;j<n;j++)
  11. cin>>a[i][j];
  12. for (i=0;i<m;i++)
  13.     for (j=0;j<n;j++)
  14.         cin>>b[i][j];
  15. for (i=0;i<m;i++)
  16. for (j=0;j<n;j++)
  17. c[i][j]=a[i][j]+b[i][j];
  18.  
  19. for (i=0;i<m;i++){
  20.     for (j=0;j<n;j++)
  21.    cout<<c[i][j]<<' ';
  22.     cout<<endl;
  23. }
  24.     return 0;//
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement