title: C Program - Calculate And Display Each Year Population using the provided equation
body: <p>This is the code I've finished, but for some reasons, which I still can't figure out why. It would display the proper population for year 0 properly, but for year 1, it would take the value of the previous year of population and multiply by the rate instead of using the provided equation that I use in the code
  The equation is NextYr = Rate * CurrentYr * (1-(CurrentYr/1000000))</p>
  
  <p>Any help would be much appreciated ! </p>
  
  <p>For example, </p>
  
  <pre><code>Enter the initial egret population: 12
  Enter the rate: 2
  
  Year     Population
    0              12
    1              24
    2              48
    3              96
  and so on
  </code></pre>
  
  <hr>
  
  <pre><code>#include&lt;stdio.h&gt;
   int main()
  {
  int count=1,year_num;
  float Rate;
  unsigned long CurrentYr;
  unsigned long NextYr;
  
  while (count&lt;=1)
  {
      printf("Enter the initial egret population: ");
      scanf("%d",&amp;CurrentYr);
      printf("Enter the rate: ");
      scanf("%f",&amp;Rate);
  
      printf("Year  Population\n");
      printf("----  ----------\n");
  
  
  
      if ((CurrentYr&gt;0 &amp;&amp; CurrentYr&lt;1000000) &amp;&amp; (Rate&gt;0 &amp;&amp; Rate&lt;4))
      {
          NextYr = CurrentYr;
          for(year_num=0;year_num&lt;=25;year_num++)
          {
              NextYr = Rate * NextYr * (1-NextYr/1000000);
              printf("%4d%12d\n",year_num,NextYr);
  
          }
          break;
      }
  
      else if ((CurrentYr &lt; 0 || CurrentYr &gt; 1000000) || (Rate&lt;0 || Rate&gt;4))
      {
          printf("Invalid Input!");
          printf("Enter the initial egret population: ");
          scanf("%d",&amp;CurrentYr);
          printf("Enter the rate: ");
          scanf("%f",&amp;Rate);
      if ((CurrentYr&gt;0 &amp;&amp; CurrentYr&lt;1000000) &amp;&amp; (Rate&gt;0 &amp;&amp; Rate&lt;4))
      {
          NextYr = CurrentYr;
  
          for(year_num=0;year_num&lt;=25;year_num++)
          {
              printf("%4d%12d\n",year_num,NextYr);
              NextYr = Rate * NextYr * (1-NextYr/1000000);
  
  
          }
          break;
  
      }
      else
      {
          printf("No more chance ! Bye ! ");
      }
  }
  return 0;
  }
  }
  </code></pre>