title: Algorithm to generate all possible combinations of 0s & 1s, for any length of digits
body: <p>I would like to know how can I print n number of combinations of 1s and 0s. The number of combinations, <code>n</code> is user defined. The expected outputs are;</p>
  
  <p>n=1;</p>
  
  <pre><code>0,1
  </code></pre>
  
  <p>n=2;</p>
  
  <pre><code>00,01,10,11
  </code></pre>
  
  <p>n=3;</p>
  
  <pre><code>000,001,010,011,100,101,110,111
  </code></pre>
  
  <p>etc.. etc..</p>
  
  <p>The outputs will have <code>2^n</code> number of combinations (where n is the number of expected digits in a single combination).</p>
  
  <p>How can I do this without using any built in function? The question is language independent and is for algorithm.</p>