Rotate image problem

this program is giving correct output given in the program but not passing the test cases
#include
using namespace std;
int main()
{
int n;
cin>>n;
int a[1000][1000];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cin>>a[i][j];
}
}
for(int i=0;i<n;i++)
{
int sc=0;
int ec=n-1;
while(sc<ec)
{
swap(a[i][sc],a[i][ec]);
sc++;
ec–;
}
}
int t[n][n];
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
t[i][j]=a[j][i];
}
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
{
cout<<t[i][j]<<" ";
}
cout<<endl;
}
return 0;
}

Save your code on ide.codingblocks.com and then share its link.

You can cross check your logic from here Rotate Image Question

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.