Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int a[101][101];
- int euclid (int a,int b)
- {
- int r;
- while(b!=0)
- {
- r=a%b;
- a=b;
- b=r;
- }
- return a;
- }
- int main()
- {
- int n,i,j,s=0,S=0,x;
- cin>>n;
- 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)
- {
- s+=a[i][j];
- }
- }
- }
- for(i=1; i<=n; i++)
- {
- for(j=1; j<=n; j++)
- {
- if(i>j)
- {
- S+=a[i][j];
- }
- }
- }
- x=euclid(s,S);
- cout<<x;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement