gashink_t

битовые операции

Feb 12th, 2020
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.20 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int n, k=0;
  5.     printf("vvedite chislo: n = ");
  6.     scanf("%d", &n);
  7.     while (n!=0) { 
  8.         if (n%2==1) k++;
  9.         n=n/2;
  10.     }
  11.     printf("v chisle n %d edenic\n", k);
  12.     return 0;
  13. }
Add Comment
Please, Sign In to add comment