title: Why doesn't my program go to next question
body: <p>I'm attempting to write a small program that a user input book information in the &quot;struct bookinfo&quot; and then print what user write.</p>
  <p>I accepted some advice in my past question. so I modified my program but It is still not working
  problem is that my program doesn't go to next question. If I put a character in integer variable
  It goes to next question but skip next question again!</p>
  <p>here is my code</p>
  <pre><code>#include &lt;stdio.h&gt; 
  #include &lt;stdlib.h&gt;
  
  struct bookInfo {
      char title [40];
      char author [25];
      float price;
      int pages;
  };
  
  main()
  {
      int ctr;
      struct bookInfo books[3];
      for (ctr = 0 ; ctr&lt; 3; ctr++)
      {
          printf(&quot;What is the name of the book #%d?\n&quot;, (ctr+1));
          scanf( &quot; %s&quot;, books[ctr]. title);
          puts(&quot;who is the author?&quot;);
          scanf(&quot; %s&quot;, books[ctr].author);
          puts(&quot;How much did the book cost? &quot;);
          scanf(&quot;%f&quot;, &amp;books[ctr].price);
          puts(&quot;How many pages in the book? &quot;);
          scanf(&quot;%d&quot;, &amp;books[ctr].pages);
          getchar();
      }
  </code></pre>
  <p>output is Here.</p>
  <pre><code>What is the name of the book #1?
  cosmos
  who is the author?
  kalcaygon
  How much did the book cost?
  14.99
  </code></pre>
  <p>and then, my program doesn't go to next question. but when I put a character, it go to next question. but skip next input like this</p>
  <pre><code>What is the name of the book #1?
  cosmos
  who is the author?
  kalcaygon
  How much did the book cost?
  14.99
  
  
  
  
  
  d
  How many pages in the book?
  who is the author?
  How much did the book cost?
  </code></pre>