Ian Malven

Ian Malven

  • NA
  • 2
  • 8.5k

I have bugs in my program but am failing to find them help please

Oct 25 2012 8:42 AM
I have a code with me that i would like to use ,what this code should do is that it reads the amount of data to be input and it counts the number of even and odd numbers from input data here is the code :
#include<stdio.h>
void main(    )
{
int x,count,countEven,countOdd,num;
printf("Enter number of data\n");
scanf("%d",&count);
while(x<count)
{
printf("Enter positive interger:\n");
scanf("%d",&num);
if(num%2==0)
countEven++;
else
x++;
}
countOdd++;
printf("Number of even intergers is %d\n",countEven);
printf("Number of odd intergers is %d\n",countOdd);
}
//countOdd represents the number of odd intergers
//countEven represents the number of even intergers
//count represents the amount of data to be input
//x represents number of digits entered
PLEASE HELP ME FIND WHERE THIS CODE IS GOING WRONG


Answers (3)