title: While loop in C don't break even after encountering a NULL character
body: <p>here is the code to add the numbers present in an Alphanumeric string :</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  int main()
  {
  int total=0;
  char ch;
  printf("enter the string\n");
  ch=getchar();
  while(ch!='\0')
  {
      printf("I am here !!");
      if (!(isalpha(ch)))
          total+=(int)ch;
      ch=(char)getchar();
      printf("I am here !!");
  }
  printf("\ntotal is %d",total);
  return 0;
  }
  </code></pre>
  
  <p>No matter what characters I input , it gives 4 " I am here " for each character.</p>
  
  <p>I tried to use</p>
  
  <pre><code>while((ch=getchar())!='\0');
  </code></pre>
  
  <p>but it gives the same problem . </p>