Damn-short solution, I could fit it in a comment:
#include<stdio.h>
main(N,L,B)
{
    N=114067,L=B=N&1;
    while(N>>=1)B=(L=(N&1)?L+1:0)>B?L:B;
    return !printf("%d",B);
}
Live demo link.
Nah... that was too short to understand anything, let's expand it a little:
#include <stdio.h>
int main()
{
    int N = 0; // input value, will be read with scanf()
    int currentLength = 0; // here we will store the current number of consecutive ones
    int bestLength = 0; // here we will store the best result
    scanf("%d", &N); // read the input value from standard input
    while (N) // as long as N is greater than 0
    {
        if (N & 1) // if the last bit is set to 1
        {
            // cool, let's increment the current sequence's length
            currentLength += 1;
            // currentLength has changed, maybe now it is better than best known solution?
            if (currentLength > bestLength)
            {
                // awesome! new best solution is found
                bestLength = currentLength;
            }
        }
        else
        {
            // we have encountered 0 while scanning bits, we must start counting the length over
            currentLength = 0;
        }
        // let's move to the next bit!
        N = N >> 1;
    }
    printf("%d", bestLength); // print out the value
    return 0;
}
One more live demo link.