idk why my program is not working, i wanted to create a program that counts even and odd number when a user inputs number except 0. Zero is the terminator of the loop.
#include <stdio.h>
int main(){
int entNum, ans;
int even;
int odd;
do{
even=0;
odd=0;
scanf("%d",&entNum);
ans = entNum%2;
if(ans==0){
even++;
}
else if(ans!=0) {
odd++;
}
}while(entNum!=0);
printf("Even: %d",even);
printf("Odd: %d",odd);
getchar();
}