/* EASTER.C    An Easter Datecalculating program for Orthodox/Catholic Easter
               C code ported from PASCAL by melody@compulink.gr modifications
               by gj489@po.cwru.edu You may distribute the source as is  */

#include <stdio.h>
main()
   {
   int year,a1,a2,a3,b1,b2,d,z;
   enter_year:
   printf("Enter year : ");
   scanf("%d",&year);
   if (year <= 0)
      {
      printf("Illigal year. Use years > 0");
      goto enter_year;
      }
   a1=year-(year/19)*19;
   a1=a1*19+16;
   a2=year-(year/4)*4;
   a2=a2*2;
   a3=year-(year/7)*7;
   a2=a2+4*a3;
   b1=a1-(a1/30)*30;
   a2=a2+6*b1;
   b2=a2-(a2/7)*7;
   d=3+b1+b2;
   printf("Easter day for %d is:\n",year);
   if (d <= 30)
      {
      printf("Orthodox Easter is on April %d\n",d);
      if (d <= 7)
         {
         z=7-d;
         printf("Catholic Easter is on March %d\n",31-z);
         }
      else
         {
         printf("Catholic Easter is on April %d\n",d-7);
         }
      }
   else
      {
      printf("Orthodox Easter is on May %d\n",d-30);
      z=d-30;
      if (z <= 7)
         {
         printf("Catholic Easter is on April %d\n",30-7+z);
         }
      else
         {
         printf("Catholic Easter is on May %d\n",d-37);
         }      
      }
  }
