Arrays-Spiral print Anticlockwise

#include
using namespace std;
void spiralform(int a[][10],int m,int n){
int startcol=0;
int endcol=n-1;
int startrow=0;
int endrow=m-1;

while(startcol<=endcol and startrow<=endrow){
 for(int i=startcol;i<=endrow;i++){
	 cout<<a[i][startcol]<<", ";
}
startcol++;
for(int i=startcol;i<=endcol;i++){
	cout<<a[endrow][i]<<", ";
}
endrow--;
if(startcol<endcol){
	for(int i=endrow;i>=startrow;i--){
		cout<<a[startcol][i]<<", ";
	}
endcol--;
}
if(startrow<endrow){
	for(int i=endcol;i>=startcol;i--){
		cout<<a[startrow][i]<<", ";
	}

startrow++;
}
}
cout<<"END";

}
int main() {
int m,n;
cin>>m>>n;
int a[10][10];

for(int row=0;row=m-1;row++){
	for(int col=0;col<=n-1;col++){
		cin>>a[row][col];
	}
}
spiralform(a,m,n);
return 0;

}

I cant understand why my code is not running

I have corrected your code and added the comments please check it

The compiler is showing me TLE.

the code i provided is passing all the test cases, please make sure you are submitting the correct code!!!

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.