> For the complete documentation index, see [llms.txt](https://kkishan114.gitbook.io/30-days-of-code/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kkishan114.gitbook.io/30-days-of-code/index/day-10-binary-numbers.md).

# Day 10: Binary Numbers

### Problem Link <a href="#problem" id="problem"></a>

* [x] [**HackerRank Problem Link**](https://www.hackerrank.com/challenges/30-binary-numbers/problem)

### Solution

* [x] **In C++ Language**

{% code title="Binary\_Num.cpp" %}

```cpp
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,count=0,max=0;
    cin >> n;

    while(n)
    {
        if (n&1)
            count++;
        else 
            count = 0;
        if (max < count)
            max = count;
        n>>=1;
    }
    cout << max;

    return 0;
}

```

{% endcode %}
