title: Recursion Backtracking to print all combinations of binary numbers of length N without using loops
body: <p>Need help to print all combinations of binary digits using recursion and no loops.</p>
  
  <pre><code>void printBinary(int n)
  {
      if(n==1)
      {
          cout &lt;&lt; "0" &lt;&lt; endl;
          cout &lt;&lt; "1" &lt;&lt; endl;
      }
      else 
      {
          // How do I call?
      }
  
  }
  </code></pre>
  
  <p>Sample output for <code>printBinary(3)</code>:</p>
  
  <pre><code>000
  001
  010
  011
  100
  101
  110
  111
  </code></pre>