# 11138 - Binary addition >author: Utin ###### tags: `bitwise` --- ## Brief See the code below ## Solution 0 ```c= #include <stdio.h> void output(int tmp) { if (!tmp) return; output(tmp / 2); printf("%d", tmp % 2); } int main() { int n, ans = 0; scanf("%d", &n); output(n + 1); printf(" "); while ((1 << ans) & n) ans++; printf("%d\n", ans); } // Utin ``` ## Reference
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up