#include <iostream.h>
using namespace std;
int main()
{
int n, i, j;
int a [n][n];
srand(time(0));
cout << "n= ";
cin >> n;
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
{
a[i][j]=rand()%10-2;
cout << a[i][j] << " ";
};
cout << "\n";
};
for (i=0; i<n; i++)
for (j=0; j<n; j++)
if (i == j)
a[i][j]=0;
for (i=0; i<n; i++)
for (j=0; j<n; j++)
if (i>j)
a[i][j]=a[i][j]*a[i][j];
int s=0;
for (i=0; i<n; i++)
for (j=0; j<n; j++)
s+=a[i][j];
cout << "\n";
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
cout << a[i][j] << " ";
cout << "\n";
};
cout << "\n";
cout << "\ns= " << s;
system("\npause");
return 0;
}