title: C Program: How to set custom integer range, strictly limiting the accepted input numbers within that range only?
body: <p>Let's consider a case where a program has to take a number as an input from the user, only within a strict range of any between 1 and 10,00,000,000? Is it possible in C? If yes, it would be nice if someone can explain this by making modifications to following example program.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  {
      unsigned long int n, e1,e2,e3;
      int counter;
  
      for(counter=0; counter&lt;10; counter++)
      {
  
          scanf("%ld",&amp;n); // how to restrict this between 1 to 10,000,000,000?
  
          e1=n/2;
          e2=n/3;
          e3=n/4;
  
          if(e1+e2+e3&lt;n)
          {
              printf("%ld\n",n);
          }
  
          else
  
              printf("%ld\n",e1+e2+e3);
  
      }
  
      return 0;
  }
  </code></pre>