title: Read user input until a specific character is encountered
body: <p>Can someone please provide me some examples? Thank you :)</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main()
  {
      int tcount = 0, ccount = 0, dcount = 0;
      char ch;
      printf("Enter your characters (! to end): \n");
  
      /* What program code to write to get the result? */
  
      printf("digits: %d\n", dcount);
      printf("letters: %d\n", ccount);
      return 0;
  }
  </code></pre>
  
  <p>is it using for loop?</p>
  
  <pre><code>    for (tcount=0;tcount&lt;10;tcount++)
      {
          scanf("%c",&amp;ch);
          if(ch == '!')
              break;
      }
  </code></pre>
  
  <p>Test Result:</p>
  
  <p>hello 5432 user#</p>
  
  <p>digits: 4  letters: 9</p>