MCPcopy Create free account
hub / github.com/Vishruth-S/CompetitiveCode / main

Function main

Hackerrank_problems/Binary numbers/solution.C:14–31  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12
13
14int main()
15{
16 int a[10000],n,count=0,max=0;
17
18scanf("%d",&n); //enter the integer
19while(n){
20if(n%2!=0) //if n is divisible by 2 then count will increase by 1
21
22count++;
23else
24count=0; //else count will remain 0
25if(max<count) //if count's value is greater than max's value
26max=count; //then count's value is stored in max
27n>>=1;
28}
29printf("%d",max); //value stored in max is printed.
30return 0;
31}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected