title: Recursive function to counting specific digit
body: <p>I need to create a recursive function that counts the <code>2</code> and <code>6</code> from the number a user inputs. </p>
  
  <p>For example if the user enters <code>26827</code> the count is <code>3</code>.</p>
  
  <p>It works with certain numbers and certain numbers it doesn't. Can someone please modify my function making sure its recursive and using very basic C++ language as I have used. Thank you! (I believe something is wrong with return type.) </p>
  
  <pre class="lang-c++ prettyprint-override"><code>int count(int n) {
      static int count = 0; 
      if (n == 2 || n == 6) count++;
      if ((n % 10 == 2) || (n % 10 == 6)) {
          count++; 
          count(num / 10);
      }
      else return count;  
  }
  </code></pre>