Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<fstream>
- using namespace std;
- ifstream fin("bac.txt");
- int a[25][25];
- int main()
- {
- int i,j,L,C,n,s=0;
- cin>>n;
- cin>>L>>C;
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- cin>>a[i][j];
- for(i=1;i<=n;i++)
- {
- for(j=1;j<=n;j++)
- {
- if(i+j==L+C) s=s+a[i][j];;
- }
- }
- cout<<s;
- }
Add Comment
Please, Sign In to add comment