(Created page with "{{{ #include<stdio.h> void main() { int num,rem,cnt=0; printf("\n Enter number"); scanf("%d",&num); while(num>0) { rem=num%2; num=num/2; if(rem==1) { cnt++; } } printf("%d",c...")
 
Line 1: Line 1:
{{{
+
<syntaxhighlight lang="c">
 
#include<stdio.h>
 
#include<stdio.h>
 
void main()
 
void main()
Line 17: Line 17:
 
  printf("%d",cnt);
 
  printf("%d",cnt);
 
}
 
}
}}}
+
 +
</syntaxhighlight>

Revision as of 19:37, 18 October 2013

#include<stdio.h>
void main()
{
int num,rem,cnt=0;
printf("\n Enter number");
scanf("%d",&num);
while(num>0)
{
rem=num%2;
num=num/2;
if(rem==1)
{
cnt++;
}
}
 printf("%d",cnt);
}