title: Finding digits (in a number) that exactly divide the number
body: <p>I am writing a program to find the number of digits in a number that exactly divide that number (remainder=0). </p>
  
  <p>For example, for 145. There are 2 digits that divide 145, 1 and 5(145%2=0,145%1=0).</p>
  
  <p>When a number contains a 0 as a digit, like 102, the program fails. I understand that I can't divide by zero, i tried to solve this, but the program is still not working. Any suggestions on how to avoid division by zero?</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  int main(){
  std::cout&lt;&lt;"Enter a number: ";
  int n,digit,count=0;
  std::cin&gt;&gt;n;
  
      while(n){
          digit = n%10;
          if(digit==0) continue;
          else{
              if(n%(digit)==0) count++; n /= 10;}
      }
  
  std::cout&lt;&lt;"Number of digits that divide the number: "&lt;&lt;count&lt;&lt;"\n"; count=0;
  }
  </code></pre>