Dátum: 1998. április 8., szerda (09:37 UT) |
Feladó: Kvi |
Tárgy: Re: ---=== CSILLA #454. ===--- win |
Szia Hev és mindenki,
> Kellene nekem egy olyan program amivel 2025-ig elore ki lehet
> szamitani, hogy mikor lesz Husvet!
Hirtelen csak ezt a pascal programot találtam.
PROCEDURE DateOfEaster (Yr : WORD; VAR Mo, Da : WORD);
{ Algorithm "E" from Knuth's "Art of Computer Programming", vol. 1 }
{ Computes date of Easter for any year in the Gregorian calendar }
{ The local variables are the variable names used by Knuth. }
{ GIVEN: Yr - year }
{ RETURNS: Mo - month of Easter (3 or 4) }
{ Da - day of Easter }
VAR
G, C, X, Z, D, E, N : LONGINT;
BEGIN
{ Golden number of the year in Metonic cycle }
G := Yr MOD 19 + 1;
{ Century }
C := Yr DIV 100 + 1;
{ Corrections: }
{ <X> is the no. of years in which leap-year was dropped in }
{ order to keep step with the sun }
{ <Z> is a special correction to synchronize Easter with the }
{ moon's orbit . }
X := (3 * C) DIV 4 - 12;
Z := (8 * C + 5) DIV 25 - 5;
{ <D> Find Sunday }
D := (5 * Yr) DIV 4 - X - 10;
{ Set Epact }
E := (11 * G + 20 + Z - X) MOD 30;
IF E < 0 THEN
E := E + 30;
IF ((E = 25) AND (G > 11)) OR (E = 24) THEN
E := E + 1;
{ Find full moon - the Nth of MARCH is a "calendar" full moon }
N := 44 - E;
IF N < 21 THEN
N := N + 30;
{ Advance to Sunday }
N := N + 7 - ((D + N) MOD 7);
{ Get Month and Day }
IF N > 31 THEN
BEGIN
Mo := 4;
Da := N - 31
END
ELSE
BEGIN
Mo := 3;
Da := N
END
END; { DateOfEaster }
Kvi
|