🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4704

Re: How to calculate the Holy Easter.

#4704
From: Phil Paxton
Date: Thu, 25 Jan 1996 02:19
73 lines
2496 bytes
chierici@cs.unibo.it (Andrea Chierici) writes:

>Hi, can anybody send me a C function to calculate the Easter of every year?
>Thanks in advance,
>			Andrea.

This was floating about the 'net:

Path: dorite!news.sprintlink.net!gatech!news.mathworks.com!news.kei.com!simtel!zippo.uwasa.fi!poiju.uwasa.fi!not-for-mail
From: A.Timmerman@beta.hsholland.nl (Abe Timmerman)
Newsgroups: comp.lang.pascal
Subject: Easter-date
Date: 24 May 1995 12:29:11 -0000
Organization: Hogeschool Holland Sector Beta
Lines: 47
Sender: ts@poiju.uwasa.fi
Approved: news@poiju.uwasa.fi
Message-ID: <ts9505241228.4174@poiju.uwasa.fi>
NNTP-Posting-Host: poiju.uwasa.fi
Summary: Reposted by Timo Salmi

I saw the message about the easter-date program and knew I had an
algorithm somewhere.

This is the algorithm Gauss published in 1800 to calculate Easter-date.
The notes in my textbook stated that the earliest date for Easter is March 22, and
the latest date is April 25.

Here's a pascal procedure for the Gauss-Easter algorithm:
------------------------------------------------------------
procedure Easter(var Month, Day: Integer; Year: Integer);
{ Based on the formulas/algorithm published bij Gauss in 1800 }
var a, b, c, d, e, f, k, m, n, p, q: Integer;
begin
  a := Year mod 19;
  b := Year mod 4;
  c := Year mod 7;
  k := Year div 100;
  p := k div 3;
  q := k - k div 4;
  m := (q - p + 15) mod 30;
  n := (q + 4) mod 7;
  d := (19*a + m) mod 30;
  e := (2*b + 4*c + 6*d + n) mod 7;
  f := d + e - 9;
  if f <= 0 then
    begin
      Month := 3;
      Day := 31 + f;
    end
  else
    begin
      Month := 4;
      if f = 26 then Day := 19
      else if (f = 25) and (d = 28) then Day := 18
      else Day := f;
    end;{ else }
end;{ Easter }

Greetings,

Abe Timmerman
Hogeschool Holland
(HHIT: Center for education and Information Technology)
The Netherlands
Email:A.Timmerman@Beta.hsholland.nl

(And remeber...)


--
 ------------------------------------
 Phil Paxton :: Fishers, Indiana, USA
Technical Details
Message-ID: <juggler.822536373@iquest.net>
Path: arc1-ca.pugleaf.net!news.sprintlink.net!news1!juggler
References: <4e5kmh$2g9@leporello.cs.unibo.it>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!news.sprintlink.net!news1!juggler
From: juggler@iquest.net (Phil Paxton)
Subject: Re: How to calculate the Holy Easter.
X-Nntp-Posting-Host: dorite.iquest.net
Message-ID: <juggler.822536373@iquest.net>
Sender: news@iquest.net (News Admin)
Organization: IQuest Internet, Inc.
X-Newsreader: NN version 6.5.0 #9 (NOV)
References: <4e5kmh$2g9@leporello.cs.unibo.it>
Date: Thu, 25 Jan 1996 02:19:33 GMT