Well... that needs a little tweaking.
You aren't processing it correctly - your definition of "odd" and "even" excludes zero and unity.
Zero I can understand (it's neither odd nor even) but one is odd.
But to exclude them, it's simple: change the initial value of
i
:
for(i=2;i<x;i++)>
Should do it.
(Do bear in mind that arrays in C / C++ / C# all start with element at index zero, not index 1: so in the string "12345" the character at index 2 is "3".
If your position values don't allow for that, you need to tweak your code slightly.