i have made the following program but i cant find what is the error...
the output is not coming correct...
for example
Enter A Binary Number 110011
Number of ones are 0
Number of zeroes are 1
void main()
{
clrscr();
int r, ones=0, zeroes=0;
long int n;
printf("Enter A Binary Number ");
scanf("%d", n);
while(n!=0)
{
r=n%10;
if(r==1)
ones++;
if(r==0)
zeroes++;
n=n/10;
}
printf("\nNumber of ones are %d", ones);
printf("\nNumber of zeroes are %d", zeroes);
getch();
}