Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ifstream f("suma_frontiera.in");
- ofstream g("suma_frontiera.out");
- int a[10][10],n,m,s=0;
- f>>n>>m;
- for(int i=0; i<n; i++)
- for(int j=0; j<m; j++)
- f>>a[i][j];
- f.close();
- for(int i=0; i<m; i++)
- s+=a[0][i];
- for(int i=1; i<n; i++)
- s+=a[i][0];
- for(int i=1; i<n; i++)
- s+=a[i][m-1];
- for(int i=1; i<m-1; i++)
- s+=a[n-1][i];
- g<<"suma_frontiera="<<s;
- g.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement