as bitwise operators are fast can count by following logic, works oly fr 
+ve, just a tweak will make it to work with -ves also ..

#include <stdio.h>
main() {
unsigned int x=12312,a;
a=x<<1;
//printf("%u",a);
int count=0;
while(x>0) {
a = x<<1;
//printf("%u \n",a);
if(a<x)
count++;
x=a;
}
printf("%d\n",count );
getch();
}

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to algogeeks+unsubscr...@googlegroups.com.


Reply via email to