what is wrong with my code works perfectly on codeblocks

#include<stdio.h>
#include<stdlib.h>
int main()
{
int N,M,a[101][101]={0},i,j;

scanf("%d %d",&N,&M);

for(i=0;i<N;i++)
{
    for(j=0;j<N;j++)
        scanf("%d",&a[i][j]);
}

while(M--)
{
    int num;
      scanf("%d",&num);

     num%=360;

     if(num==0)
     { for(i=0;i<N;i++)
        {for(j=0;j<N;j++)
         printf("%d",a[i][j]);
         printf("\n");
        }
     }
     else if(num==90)
     {
         for(i=0;i<N;i++)
         {
             for(j=N-1;j>=0;j--)

             printf("%d ",a[i][j]);
             printf("\n");
         }
     }
     else if(num==180)
     {
         for(i=N-1;i>=0;i--)
         {
             for(j=N-1;j>=0;j--)
                printf("%d ",a[i][j]);
                printf("\n");
         }
     }
     else if(num==270)
     {
         for(i=N-1;i>=0;i--)
         {
             for(j=0;j<N;j++)
                printf("%d ",a[i][j]);
                printf("\n");
         }
     }

}
return 0;
}

You did not say the problem which you are trying to solve. From the tag you provided, I guess the problem is this.

Your code gives wrong result for the provided test cases, check for the angles 90 and 270.

Also you need to print a new line after printing the matrix.

You can check my solution here for understanding.

thanks i got the mistake it was for 90 and 270 cases

@vaasaini96

You’re welcome. Glad you found the mistake.

If your question has been answered then kindly accept the correct answer as it will help others find the correct answer/explanation and also can be marked as closed.