title: How to take integer input with scanf in C without using arrays?
body: <p>I want to take input like the following:</p>
  <p><em>Write: 1 5 3</em></p>
  <p><strong>OR</strong></p>
  <p><em>Write: 1 2</em></p>
  <p><strong>OR</strong></p>
  <p><em>Write: 2 4 9 4</em></p>
  <p><strong>OR</strong></p>
  <p><em>Write: (press Enter directly)</em></p>
  <p>However, problem is that I want to take max 5 integer or less. Therefore, I wrote this expression:</p>
  <pre><code>scanf(&quot;%d %d %d %d %d&quot;,&amp;a,&amp;b,&amp;c,&amp;d,&amp;e);
  </code></pre>
  <p>When I did that, if I write integers, such as 1 4 6, the program continues to want integers until I complete the number of integers to 5.</p>
  <p>Also, sometimes, I need to skip this part by pressing enter without writing an integer. But, I can not implement that.</p>
  <p>I did that also:</p>
  <pre><code> scanf(&quot;%d%c&quot;, &amp;firstStore,&amp;control);
      if(control==' ')
      {
          scanf(&quot;%d%c&quot;, &amp;secondStore,&amp;control);
          if(control==' ')
          {
              scanf(&quot;%d%c&quot;, &amp;thirdStore,&amp;control);
              if(control==' ')
              {
                  scanf(&quot;%d%c&quot;, &amp;fourthStore,&amp;control);
                  if(control==' ')
                  {
                      scanf(&quot;%d&quot;, &amp;fifthStore);
                  }
              }
          }
      }
  </code></pre>
  <p>The problem with this code is that I can not skip this part if I want. I mean this code wants to take minimum one integer always.</p>
  <p><strong>RULE:</strong></p>
  <p><em>The usage of arrays is banned.</em></p>