title: floating point exception in c program
body: <p>I am having floating point exception in the following code . </p>
  
  <pre><code>int heavy_decimal_count ( int A, int B )        
  {        
   char * markup = "Heavy";    
   int i , value;   
   int tempA = A;   
   int tempB = B;    
   int reminder = 0;    
   int sum = 0;     
   float average = 0.00;     
   int counter = 0;    
   if( (tempA &lt; 0) || ( tempB &lt;0 )||( B &lt; A ) )    
   {    
      printf(" Error -&gt; Numbers are negative or B is less than A");     
      return 0;     
   }    
   for (  i = A ; i &lt;= B ; i++)     
   {    
       value = i;     
       while( value &gt; 0 )    
       {    
          printf(" the value is %d ", value );     
          counter += counter;     
          reminder = value % 10;      
          value /= 10;    
          sum += reminder;     
          average =  sum/counter ;     
  
      }     
      if( average &gt; 7.0 )    
              printf(" %d \t  avg= %f\t %s\t" ,i , average , markup);   
          else     
              printf(" %d \t  avg=%f\t " ,i , average );     
  }     
  return 0;      
   }     
  </code></pre>