title: How to use a character to quit a loop in c Language?
body: <p><strong>How to use q as character to  exit ?</strong>
  How to use q as a quit to this code. It loops till it gets the ASCII values of q.
  `</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
    int pos=0,neg=0,zero=0,i=0,num;
    printf("Input numbers.");
    scanf("%d",&amp;num);
    for(i=0;num!="q";i++)
    {
  
        if(num&gt;0)
        {
            pos++;
        }
        if(num&lt;0)
        {
            neg++;
        }
        if(num==0)
        {
            zero++;
        }
    }
    printf("You entered \n\tpositive number::: %d times\nNegative number:::%d times\nZero:::%d times",pos,neg,zero);
  
  
  }
  </code></pre>
  
  <p>`</p>