title: I wonder why it doesn't work
body: <p>I want this program show following.</p>
  
  <pre><code>Data input (Ctrl+Z to exit) : a
  Data input (Ctrl+Z to exit) : b
  Data input (Ctrl+Z to exit) : ^Z
  sum : 2
  </code></pre>
  
  <p>But when I execute this code, <code>Data input (Ctrl+Z to exit) :</code> printed a few times.</p>
  
  <p>For example, when I input 'A', of course 'A enter' 2 characters,then 2 times of "Data input (Ctrl+Z to exit) : " printed.</p>
  
  <pre><code>int main(void) 
  {
      int cnt = 0;
      char input;
  
      while (1) {
          fputs("Data input (Ctrl+Z to exit) : ", stdout);
          input = getchar();
  
          if (input == EOF)
              break;
  
          fflush(stdin);
          cnt++;
      }
      printf("sum : %d", cnt);
      return 0;
  }
  </code></pre>