Von neuman loves binary hackerblocks

there is no output on the screen after running my code

Hello @akarshiarora.17,

There are multiple issues with your program:

  1. how would you distinguish between the n.
    int n;
    cin>>n; //this is number of binary strings

    int i=0;
    while(i<=n){
    cin>>n; // now you are overwriting it’s value with the first binary string.
    }

  2. Please, review the following code, it is logically incorrect:
    while(n!=0){

       r=n%10;
       dec=dec+r*pow(2,i);
       n=n/10;
          i=i+1;
       cout<<dec<<endl;
    }
    

I would suggest you to dry run your code on a sample input.

Hope, this would help.

1 Like

Thanks a lot .I got my mistake and now my coderan successfully.

Please mark the doubt as resolved.
BTW, i won’t mind a like.:joy: