#include <stdio.h>
int num[1000];
int main() {
    int n,i=0;
    int r;
    scanf("%d",&n);
    if(n==0) {
        printf("0");
        return 0;
    }
        
    while(n!=0) {
        r=n%-2;
        n/=(-2);
        if(r<0) {
            r+=2;
            n++;
        }
        num[i++]=r;
    }
    for(int j=i-1; j>=0; j--) {
        printf("%d",num[j]);
    }
    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: