fork(4) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. unsigned long long bin = 0, num = 0, resp = 0, cont = 0;
  7. printf("digite um numero\n");
  8. scanf("%lld", &num);
  9. do
  10. {
  11. bin = (bin * 10) + (num % 2);
  12. num = num / 2;
  13. cont++;
  14. }
  15. while (num > 0);
  16. do
  17. {
  18. cont--;
  19. resp = (resp * 10) + (bin % 2);
  20. bin = (bin - (bin % 2)) / 10;
  21. }
  22. while (cont > 0);
  23. printf("%lld", resp);
  24. return 0;
  25. }
  26.  
  27.  
Success #stdin #stdout 0s 4536KB
stdin
1200
stdout
digite um numero
10010110000