Untitled

mail@pastecode.io avatar
unknown
plain_text
4 years ago
741 B
3
Indexable
Never
#include<stdio.h>

int main(void)
{
    int A[11]={0}, B[11]={0}, i;
    int n, m, t=0;
    0 <= n <=1024;
    scanf("%d", &n);
    i=10;
    while (i>=0)
    {
        A[i]=n%2;
        i--;
        n=n/2;
    }
    m=n+1;
    i=10;
    while (i>=0)
    {
        B[i]=m%2;
        i--;
        m=m/2;
    }
    i=0;
    while (i<=10)
    {
        if (B[i]<1)
        {
            i++;
        }
        else
        {
            while (i<=10)
            {
                printf("%d", B[i]);
                i++;
            }
        }

    }
    i=10;
    t=1;
    while (i>=0, A[i]==A[i-1] && A[i]==1)
    {
        t++;
        i--;
    }

    printf(" %d", t);
    return 0;

}