The following code is for printing the elements of a matrix in spiral order. The program works fine. The problem, however, is that the online compiler against which I\'m checkin
You can put an if condition in your for loops
if
for
for (i = l; i < n; ++i) { printf("%d", a[k][i]); if(i < n-1) printf(" "); }