You are viewing a single comment's thread. Return to all comments →
int main(){ int n,a[20],b[20],i=0,j=0,k=1; scanf("%d",&n); while(n<=2&&i<20) { if(n%2==0) { a[i]=0; n=n/2; } else { a[i]=1; n=(n-1)/2; } i++; } for(i=19;i>=0;i--) { b[j]=a[i]; j++; } while(j>19) { if((b[j]==1)&&(b[j]==b[j+1])) { k++; } j++; } printf("%d",k); return 0; }
can u help me with my code??
Seems like cookies are disabled on this browser, please enable them to open this website
Day 10: Binary Numbers
You are viewing a single comment's thread. Return to all comments →
can u help me with my code??