Răspuns:
#include <iostream>
using namespace std;
int n, i, j, a[30][30];
int main()
{
cin >> n;
for (i=0; i<n; i++)
for (j=0; j<n; j++)
cin >> a[i][j];
cout << "a) paralela la DP, deasupra:" << endl;
for (i=0; i<n-1; i++)
cout << a[i][i+1] << " ";
cout << endl;
cout << "b) paralela la DS, sub DS:" << endl;
i=n-1;
for (j=1; j<n; j++)
cout << a[i--][j] << " ";
}
Explicație: