1. When you find the string's length, you have a mistake:


for(j=0;s[j]!='\0';j++)
;
j--;


2. 10100 is correct binary for decimal 20.