Post History
C (gcc), 35 32 bytes Saved 3 bytes thanks to Lundin f(n){n&&f(n/2);putchar(n&1|48);} This solution exploits that leading zeros, while not required, are also not forbidden by the ...
Answer
#2: Post edited
# [C (gcc)], 35 bytes- <!-- language-all: lang-c -->
f(n){if(n)f(n/2);printf("%i",n%2);}- This solution exploits that leading zeros, while not required, are also not forbidden by the task.
[Try it online!][TIO-kszud5n4]- [C (gcc)]: https://gcc.gnu.org/
[TIO-kszud5n4]: https://tio.run/##S9ZNT07@/z9NI0@zOhNEArG@kaZ1QVFmXkmahpJqppJOnipQoPY/UEAhNzEzT0OTq5pLQSFNwwChLCZPSdMaLGiITdAUq0ojbKLGWA0wMbA0wxQvSi0pLcpTMLDmquX6DwA "C (gcc) – Try It Online"
- # [C (gcc)], <s>35</s> 32 bytes
- Saved 3 bytes thanks to [Lundin](https://codegolf.codidact.com/comments/thread/4298#comment-13170)
- <!-- language-all: lang-c -->
- f(n){n&&f(n/2);putchar(n&1|48);}
- This solution exploits that leading zeros, while not required, are also not forbidden by the task.
- [Try it online!][TIO-kt41w33d]
- [C (gcc)]: https://gcc.gnu.org/
- [TIO-kt41w33d]: https://tio.run/##S9ZNT07@/z9NI0@zOk9NDUjrG2laF5SWJGckFmnkqRnWmFhoWtf@z8wrUchNzMzT0OSq5lJQSNMwAKoqAoqmaSjF5ClpWoMFDbEJmmJVaYRN1BirASYGlmaY4kWpJaVFeQoG1ly1XP8B "C (gcc) – Try It Online"
#1: Initial revision
# [C (gcc)], 35 bytes <!-- language-all: lang-c --> f(n){if(n)f(n/2);printf("%i",n%2);} This solution exploits that leading zeros, while not required, are also not forbidden by the task. [Try it online!][TIO-kszud5n4] [C (gcc)]: https://gcc.gnu.org/ [TIO-kszud5n4]: https://tio.run/##S9ZNT07@/z9NI0@zOhNEArG@kaZ1QVFmXkmahpJqppJOnipQoPY/UEAhNzEzT0OTq5pLQSFNwwChLCZPSdMaLGiITdAUq0ojbKLGWA0wMbA0wxQvSi0pLcpTMLDmquX6DwA "C (gcc) – Try It Online"