Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #define CODD(x,c)\
- { \
- for(c=0; x>0; x=x>>2){\
- c += x&1;\
- }\
- }
- int main(){
- int b = 111111, c; /* 1011 */
- CODD(b,c);
- printf("%d\n",c);
- return 0;
- }
- /*
- 32 16 8 4 2 1
- 1 1 * 1 * 1 == 53
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement