I assume you're asking why it doesn't go into the second IF statement (i.e. the
"if (j%2==0)" one)?
You're calculating "halfcount" in the wrong place. It gets set to zero and
stays there. The FOR loop with "j" as its control variable therefore never runs
and you never reach that IF statement at all.