Guest User

Untitled

a guest
Jan 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. #include<stdio.h>
  2. int fun(int x);
  3.  
  4. int main(void){
  5.  
  6. printf("%d",fun(456));
  7.  
  8. }
  9.  
  10. int fun(int x)
  11. {
  12. int count = 0 ;
  13.  
  14. while(x){
  15. count++ ;
  16. x = x & (x-1) ;
  17. printf("x=%d,count=%d\n",x,count);
  18. }
  19. return count ;
  20. }
Add Comment
Please, Sign In to add comment