Untitled
raw download clone
C
views 23
,
size 523 b
#include<stdio.h>

int main(void){

    int x;

    scanf("%d", &x);
    x = x + 1;

    int a[100000];
    int i, j;

    for(i = 0; x != 0; i++){
        a[i] = x % 2;
        x = x/2;
        //printf("%d\n", i);
    }
    //printf("%d\n", i);
    i--;

    while(i >= 0){
        printf("%d",a[i]);
        i--;
    }

    if( a[0] == 1 ) printf(" 0");

    else{
        j = 1;
        while(a[j] = 0){
                j++;
        }
        printf(" %d", j);
    }
    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.