Untitled
raw download clone
TEXT
views 22
,
size 425 b
#include <stdio.h>
int bin(int);
int main()
{
    int n,k=1;
    scanf("%d",&n);
    n=n+1;
    bin(n);

    for(int i=1; i<5; i++)
    {
        if((n/(10^i)) >= 1)
        {
            k ++;
            n/=10;
        }
    }
    printf(" %d",k);
    return 0;
}
int bin(int x)
{
    int j=0;
    if(x <= 0)
        return;
    else
    {
        bin(x/2);
        printf("%d",x%2);
    }
}
close fullscreen
Login or Register to edit or fork this paste. It's free.