title: how to make this program can accept the negative number
body: <p>I make this code and then the code cant accept the -1 number. If i input -1 number the code will break. i want to make if the accept the -1 number the 
   total variable will be + zero and then the n will be minus by 1</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(void) {
      float n, x, total = 0;
      scanf("%f",&amp;n);
      if(n&gt;=1 &amp;&amp; n&lt;=100){
          for(int a=1;a&lt;=n;a++){
              scanf("%f",&amp;x);
              if(x&gt;=-1 &amp;&amp; x&lt;=4){
                  if(x&gt;=0){
                      total=total+x;
                  } else {
                      total+=0;
                      n--;
                  }
              }
          }
          printf("%.3f",total/n);
      }
      return 0;
  }
  </code></pre>