SHARE
TWEET

Untitled

a guest Dec 11th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n,i,j,a[100][100],s=0,dif=0,S=0;
  9.     cin>>n;
  10.     for(i=1;i<=n;i++)
  11.     {
  12.         for(j=1;j<=n;j++)
  13.             cin>>a[i][j];
  14.     }
  15.     for(i=1;i<=n;i++)
  16.     {
  17.         s+=a[i][i];
  18.     }
  19.     for(i=1;i<=n;i++)
  20.     {
  21.         S+=a[i][n+1-i];
  22.     }
  23.     dif=abs(s-S);
  24.     cout<<dif;
  25.     return 0;
  26. }
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
 
Top