Advertisement
Guest User

dupa

a guest
Dec 10th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<stdlib.h>
  3. int find(int decimal_number)
  4. {
  5. if (decimal_number == 0)
  6. return 0;
  7. else
  8. return (decimal_number % 2 + 10 *
  9. find(decimal_number / 2));
  10. }
  11. int main()
  12. {
  13. int decimal_number = 34;
  14. printf("%d", find(decimal_number));
  15. return 0;
  16. }
  17.  
  18. /*
  19. 34/2=2*17=34+0
  20. 17/2=2*8 =16+1
  21. 8/2=2*4 =8 +0
  22. 4/2=2*2 =8 +0
  23. 2/2=2*1 =2 +0
  24. 1/2=2*0 =0 +1
  25. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement