SHARE
TWEET

Untitled

a guest Dec 11th, 2019 89 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int a[101][101];
  5. int euclid (int a,int b)
  6. {
  7.     int r;
  8.     while(b!=0)
  9.     {
  10.         r=a%b;
  11.         a=b;
  12.         b=r;
  13.  
  14.     }
  15.     return a;
  16. }
  17. int main()
  18. {
  19.     int n,i,j,s=0,S=0,x;
  20.     cin>>n;
  21.     for(i=1; i<=n; i++)
  22.     {
  23.         for(j=1; j<=n; j++)
  24.             cin>>a[i][j];
  25.     }
  26.     for(i=1; i<=n; i++)
  27.     {
  28.         for(j=1; j<=n; j++)
  29.         {
  30.             if(i<j)
  31.             {
  32.                 s+=a[i][j];
  33.  
  34.             }
  35.         }
  36.     }
  37.    for(i=1; i<=n; i++)
  38.     {
  39.         for(j=1; j<=n; j++)
  40.         {
  41.             if(i>j)
  42.             {
  43.                 S+=a[i][j];
  44.  
  45.             }
  46.         }
  47.     }
  48.     x=euclid(s,S);
  49.     cout<<x;
  50.     return 0;
  51. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top