My code giving wrong output

#include
using namespace std;
void rotate(int a[][1000], int n)
{
int i = 0, j = n - 1;

for (int R = 0; R < n; R++)
{
	while (i < j)
	{
		swap(a[i][R], a[j][R]);
		i++;
		j--;
	}
}

{

for (int i = 0; i < n; i++)
{
	for (int j = 0; j < n; j++)
	{
	    if(i<j)
	    {
		swap(a[i][j],a[j][i]);
	    }
	        
	    }
	
}

}

}

int main()
{
int n,a[1000][1000];
cin >>n;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin >> a[i][j];
}
}
rotate( a, n);

for (int i = 0; i < n; i++)
{
	for (int j = 0; j < n; j++)
	{
		cout<< a[i][j];
	}
	cout<<endl;
}

}

please help

@harryson
Hello Harshit,
please paste your code at coding blocks ide . and share the generated link here