I am taking one number and converting it into binary and checking each bit whether it is 1 and if it is 1 then is added to next bit which is 1 and result is stored in c.
clc;q=347;q=dec2bin(q)n=size(q,2)c='0'for i=1:n if q(i)==1 c=c+q(i) endend
Best Answer