Alx09

Test Flavius

Jun 1st, 2020
1,165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void PuteriDoi(int n) {
  5.     int x;
  6.     if (n != 0) {
  7.         x = n & (n - 1);
  8.         printf("%d ", n - x);
  9.         PuteriDoi(x);
  10.     }
  11. }
  12.  
  13.  
  14.  
  15. int main() {
  16.     int n;
  17.     printf("n= "); scanf("%d", &n);
  18.     PuteriDoi(n);
  19.     printf("\n");
  20. }
Advertisement
Add Comment
Please, Sign In to add comment