i think you intended
if (i%2==0)
{
if (digitalRead (13)==0)
digitalWrite (3,HIGH);
else if (digitalRead (13)==1)
digitalWrite (3,HIGH);
}
but if the if condition is NOT true, the else is the NOT cond
if (i%2==0)
{
if (digitalRead (13)==0)
digitalWrite (3,HIGH);
else
digitalWrite (3,HIGH);
}
but looks like both the if and else do the same thing, so you probably intended
if (i%2==0)
{
if (digitalRead (13)==0)
digitalWrite (3,HIGH);
else
digitalWrite (3,LOW);
}
but this could simple be
if (i%2==0)
digitalWrite (3, ! digitalRead (13));