How to list even and odd digits from integer inputs
<p>Okay so my question is how can I display odd and even digits of a single int input not the whole input. This while using "for" or "while" loop and the % modulator. For example, the program ask a user to enter a positive integer and then it would read each digit and list even and odd digits. I was unable to find a method that reads each character except for the .charAt() but I cant make it work. This is my fail attempt. NOTE: I can't use the % modulator because idk any method to read each digit for an int. Please help, thanks. </p>

<pre><code>String = userEntry 
int r = userEntry.length() - 1;
System.out.print("The even numbers are ");

int c = 0; // 0 would count as even.
int size = 0;
while (size &lt; r &amp;&amp; c &lt; 9)
{
    if (c == userEntry.charAt(size))
    {
        outputFile.print(" " + userEntry.charAt(size));
        System.out.print(" " + userEntry.charAt(size));
        size++;
    }
    else
    {
        c+=2;
    }
</code></pre>