one test case not passing… pls tell whats the error in code…
#include
#include
using namespace std;
void rotate(int a[][10],int n){
for(int i=0;i<n;i++){
int start_col=0;
int end_col=n-1;
while(start_col<end_col){
swap(a[i][start_col],a[i][end_col]);
start_col++;
end_col–;
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
if(i<j){
swap(a[i][j],a[j][i]);
}
}
}
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cout<<a[i][j]<<" ";
}
cout<<endl;
}
}
int main(){
int arr[10][10],n;
cin>>n;
for(int i=0;i<n;i++){
for(int j=0;j<n;j++){
cin>>arr[i][j];
}
}
rotate(arr,n);
return 0;
}