program to count the number of 0's and 1's in a binary number.

 #include<stdio.h> 
 #include<conio.h>
 void main()
 {
int n,x,a,b,s;
 clrscr();
 a=0;b=0;
 printf("enter the binary no:");
 scanf("%d",&n);
 s=n;
 while(n>0)
 {
x=n%10;
 n=n/10;
 if(x==0)
 a++;
 else if(x==1)
 b++;
 }
printf("
 the number is:%d",s);
printf("
 the ones are:%d",b);
printf("
 the zeros are:%d",a);
 getch();
 }