is there any better way of finding number of 1's in binary of a number other then below:
#include<stdio.h> #include<stdlib.h> int main(){ int n; printf("enter numb\n"); scanf("%d",&n); int i=1; int count=0; for(int j=0;j<31;j++){ if(n&(i<<j)){ count++; } } printf("%d",count); system("pause"); return 0; } -- With Regards, Jalaj Jaiswal +919026283397 B.TECH IT IIIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.