title: How to enter a letter to quit a program in C
body: <p>I am new to C programming. I have been writing this code to add numbers and I just need help with this one thing. When I type the letter 'q', the program should quit and give me the sum. How am I supposed to do that? It is currently the number 0 to close the program.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main()
  
  {
  
          printf("Sum Calculator\n");
          printf("==============\n");
          printf("Enter the numbers you would like to calculate the sum of.\n");
          printf("When done, type '0' to output the results and quit.\n");
  
     float sum,num;
  
     do  
  
     {                                    
          printf("Enter a number:");
          scanf("%f",&amp;num);
          sum+=num;      
     }
    while (num!=0);
  
  
     printf("The sum of the numbers is %.6f\n",sum);
  
  return 0;
  }
  </code></pre>