title: How to read multiple Numbers from different lines in a file
body: <p>I want to implement a program which tells you on which day the eastern sunday falls on when you type in the year. However I don't want the conventional method with scanf, but rather read the year numbers from an extern text file!</p>
  
  <p>So the text file contains this: </p>
  
  <pre><code>1900
  1950
  2000
  </code></pre>
  
  <p>What I want is to save each number in every line in my 'int year' variable once which will be run through a mathematical formular that I will spare you from for now.
  So e.g. it reads 1900 so it runs that through my program and after that it starts in the second line and reads 1950 so it runs that through and lastly in the third line 2000.</p>
  
  <p>I already tried something like this but it doesn't work at all:</p>
  
  <pre><code>FILE *fp;
  fp = fopen("bla.txt", "r");
  while (!feof(fp))
  {
   fgets(year, 4, fp);
  }
  </code></pre>
  
  <p>the rest of the code btw looks like this (for those who want to see the mathematics..)</p>
  
  <pre><code>   int main()
  {
      int year;
      int a;
      int b;
      int c;
      int d;
      int e;
      int easter_sunday ;
  
  
      a = year % 19 ;
      b = year % 4 ;
      c = year % 7 ;
      d = (19 * a + 24) %30 ;
      e = (2 * b + 4 * c + 6 * d + 5) % 7 ;
      easter_sunday = (22 + d + e) ;
  
      if (easter_sunday &gt; 31)
      {
  
          printf("Easter Sunday in %d", year);
          printf(" is April %d\n", easter_sunday - 31);
  
      }
      else
      {
  
          printf (" Easter Sunday in %d", year);
          printf (" is March %d\n", easter_sunday);
  
      }
  
      fclose(fp);
  </code></pre>