why is it showing error

#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t–)
{
int n,i,j=0,k;
scanf("%d%d",&n,&k);
int t[n],d[n];
for(i=0;i<n;i++)
scanf("%d%d",&t[i],&d[i]);
for(i=0;i<n;i++)
{
if(k==0)
break;
j=j+t[i];
if(j>k)
{
t[i]=t[i]-(j-k);
break;
}
else if(j==k)
{
t[i]=0;
break;
}
else t[i]=0;
}
int m=0;

for(i=0;i<n;i++)
{
    m=m+(t[i]*d[i]);
}
printf("%d\n",m);

}
return 0;
}

Please format your code using Ctrl + K and then insert your code in it.

okay, alright, first you should have formatted your code, but it’s fine, second are those double quotes in the code to point out where the errors are ? because I am confused by those alright, now let’s get to it, you have got for( int i = 0; i&lt ; n ; ++i ) in your second for loop, edit : welp…I know this is a problem, because there can only be two semicolons in the loop, besides, what is the purposeof n in there ? alright, that and in if( j => k ), this is wrong because there is no such expression in C, there are only >= so, the correct way ridiculous, but you need to write it would be if( j >= k ). Ok, as to why it is >= have newline, so instead of =>, is because of how printf( “%d”, m ), you need to add “\n”, and it is mentioned, which is “greater than or equal”, and not “equal or greater than” becomes printf( “%d\n”, m )

how can I format my code??? and there is no syntax error. My program is running fine in codechef ide. But I think I have missed some cases which is leading to the error…

#include<stdio.h>
int main()
{
int t;
scanf("%d",&t);
while(t–)
{
int n,i,j=0,k;
scanf("%d%d",&n,&k);
int t[n],d[n];
for(i=0;i<n;i++)
scanf("%d%d",&t[i],&d[i]);
for(i=0;i<n;i++)
{
if(k==0)
break;
j=j+t[i];
if(j>k)
{
t[i]=t[i]-(j-k);
break;
}
else if(j==k)
{
t[i]=0;
break;
}
else t[i]=0;
}
int m=0;

    for(i=0;i<n;i++)
    {
        m=m+(t[i]*d[i]);
    }
    printf("%d\n",m);
}
return 0;
}

what do you mean exactly by format ? there are syntax error though, => instead of >=, and the fact that you put three semicolon( ; )s in the for loop

P.s I put them in codechef ide and I got error

ok see below codes… I think it will be ok…

is the error mentioned wrong answer ?

hmm, I think it is possible for one of the member of the array to become negative, not too sure