getting wa in knicov. here is the code

#include<stdio.h>
#include<stdlib.h>
int main()
{
int t,n,m,i,mid,count,x;
scanf("%d",&t);
while(t–)
{
scanf("%d %d",&n,&m);
if(n==1)
{
printf("%d\n",m);
continue;
}
mid=(m+1)/2;
x=0;
if(m==1)
{
printf("%d\n",n);
continue;
}
if(m==2)
{
printf("%d\n",n+1);
continue;
}
if(m==3)
{
printf("%d\n",n+2);
continue;
}
count=n+2;
x=0;
for(i=mid-4;i>=0;i–)
{
x++ ;count++;
if(x==2)
count=count+n-1;
if(x==3)
{
x=0;
i–;
}
}
x=0;
for(i=mid+2;i<m;i++)
{
x++ ;count++;
if(x==2)
count=count+n-1;
if(x==3)
{
x=0;
i++;
}
}
printf("%d\n",count);
}
}

also someone plzz tell me why this code is printed like this . I mean in the preview it was properly alligned

Abra-Kadabra Gili-gili goo moves magic wand. Fixed the formatting. :stuck_out_tongue: XD

haha @vijju123 thanks man. plzz tell how you did that

//