Simplified C Block programming problem for-loop

Hi All,

I have problem writing for-loop in simplified C block. Below is my code:

{
static double total=0;
static double square=0;
for(int N=0,N<=1000;N++)
{
square=x1*x1;
total=total+square;
}
}

when I press check code, the software pop out a lot of error message as shown in attachment file. Does anyone can help me point out what mistake I did?I am using PSIM 9.0

Hi,

there are few errors with your code, move the variable deceleration out of the “for( ; ; )” statement, the compiler we use for C does not like a variable declared here. Second you are missing a semi-colon after “N=0” you are using a comma when it needs to be a “;”. changes in bold below

{
static double total=0;
static double square=0;
int N = 0;

for(N=0;N<=1000;N++)
{
square=x1*x1;
total=total+square;
}
}