title: Codingbat- Recursion1- count7
body: <p>Can anybody help me programming the next problem (taken from <a href="http://codingbat.com/java" rel="nofollow">Codingbat</a>- <a href="http://codingbat.com/java/Recursion-1" rel="nofollow">Recursion1</a>- <a href="http://codingbat.com/prob/p101409" rel="nofollow">count7</a>)</p>
  
  <p>Given a non-negative <code>int n,</code> return the count of the <code>occurrences of 7 as a digit</code>, so for example <code>717 yields 2.</code> (no loops). Note that <code>mod (%)</code> by 10 yields the <code>rightmost digit (126 % 10 is 6),</code> while divide (/) by 10 removes the rightmost digit (126 / 10 is 12). </p>
  
  <pre><code>count7(717) → 2
  count7(7) → 1
  count7(123) → 0
  </code></pre>
  
  <p>There are some solutions which includes number of "returns".
  I would like to program the problem with only 1 "return".</p>