From the user's input total the odd and even numbers. input numbers in between 0 to 99 : <pre><code>#include &lt;iostream&gt;
using namespace std;
int main()
{
int i,t,x[20], even, odd, prime; 
cout &lt;&lt; "Enter 20 integer numbers from 0 to 99: "&lt;&lt;endl;
for (i=1;i&lt;=20;i++)
{
    cout &lt;&lt; "Input " &lt;&lt; i &lt;&lt;":";
    cin &gt;&gt; x[i];
}
cout &lt;&lt; "\nPrime numbers are: " &lt;&lt; endl ; 
prime=1;
for (i=2; i&lt;=20 ; i++)
{
    for(t=2;t&lt;x[i];t++)
    {
        if(x[i]%t==0)
        {
            prime=0;
        }
    }
    if(prime==1)
    {
        cout &lt;&lt; x[i] &lt;&lt; endl;
    }
    prime=1;
 }
 for(i=1; i&lt;=20; i++) // this is where i have problem.
 {
    if(x[i]% 2 == 0)
    {
        even++;
    }
    else 
    {
        odd++;
    }
 }
 cout &lt;&lt; "Number of odd numbers: " &lt;&lt; odd &lt;&lt; "\n";
 cout &lt;&lt; "Number of even numbers: " &lt;&lt; even &lt;&lt; "\n";
 return 0 ;  
 }
</code></pre>

<p>When i compile it shows even (40) and odd (10) for input of 0 till 19. Where it should show even 10(including the 0) and odd (10). Im not sure where am i doing it wrongly. I hope someone can help me improve the code.</p>
