Răspuns:
#include <iostream>
using namespace std;
int main()
{
int a[101][101],n,i,j;
cin>>n;
for(i=1; i<=n; ++i)
for(j=1; j<=n; ++j)
cin>>a[i][j];
for(i=1; i<=n; ++i)
for(j=1; j<=n; ++j)
if(j<n-i+1)
swap(a[i][j],a[n-j+1][n-i+1]);
for(i=1; i<=n; ++i){
for(j=1; j<=n; ++j)
cout<<a[i][j]<<" ";cout<<endl;}
return 0;
}
Explicație: