Advertisement
paranid5

дз 3

Feb 25th, 2021
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.19 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int x = 0;
  6.     int cnt = 0;
  7.    
  8.     scanf("%d", &x);
  9.    
  10.     for (; x; x /= 2)
  11.         cnt += x % 2 ? 1 : 0;
  12.    
  13.     printf("%d", cnt);
  14.     return 0;
  15. }
  16.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement