fork(1) download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int a;
  5. int b[32];
  6. int c = 0;
  7.  
  8. scanf("%d", &a);
  9.  
  10. if (a == 0) {
  11. printf("0\n");
  12. return 0;
  13. }
  14.  
  15. while (a > 0) {
  16. b[c] = a % 2;
  17. a = a / 2;
  18. c++;
  19. }
  20.  
  21. for (int d = c - 1; d >= 0; d--) {
  22. printf("%d", b[d]);
  23. }
  24.  
  25. printf("\n");
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5320KB
stdin
72
stdout
1001000