title: Simple average calculation
body: <p>I'm trying to write program calculating average of given numbers stored in an array. Amount of numbers should be not more than 100, and user should input them until a !int variable is given :</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;conio.h&gt;
  using namespace std;
  
  double average(int tab[], int i){
  
      int sum=0;
  
      for(int j=0; j&lt;i; ++j){
              sum+=tab[j];
      }
      return (double)sum/i;
  
  }
  
  int main()
  {
      int tab[100];
      int n=0;   
      int number=0;
  
  
      do {
         if(n &lt; 100){
             cout &lt;&lt; "Give " &lt;&lt; n+1 &lt;&lt; " number : ";
             cin &gt;&gt; number;
             tab[n]=number;
             number=0;
             ++n;       
         }
         else{
              break;
         }
      } while( !isdigit(number) );      
  
      cout &lt;&lt; average(tab, n) &lt;&lt; endl;
  
      getch();
      return 0;
  }
  </code></pre>
  
  <p>Why after giving char, it prints me 'Give n number:' for all empty cells of my array ? It should end and use only given numbers.</p>