Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int a[101][101], sp,ss,n;
  6.  
  7. void citire ()
  8. {
  9. cin>>n;
  10. for (int i=1;i<=n;i++)
  11. for (int j=1;j<=n;j++)
  12. {
  13. cin>>a[i][j];
  14. // if (i==j)
  15. // sumdiag+=a[i][j];
  16. // if (i+j==n+1)
  17. // sumgiag2+=a[i][j];
  18. }
  19. for (int i=1;i<=n;i++)
  20. {
  21. sp+=a[i][i];
  22. ss+=a[i][n-i+1];
  23. }
  24. if (sp>ss)
  25. cout<<sp-ss;
  26. else cout<<ss-sp;
  27.  
  28. }
  29.  
  30. int main()
  31. {
  32. citire();
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement