The Easter Sunday Problem Venkatesh Ramamoorthy 11-Feb-2005
Floor of a variable  x   = The greatest  integer  less than, or equal to  x Examples  3   = 3  3.5   = 3  –4   = –4  –4.75   = –5
Ceiling of a variable  x  = The smallest  integer  greater than, or equal to  x Examples  3   = 3  3.5   = 4  – 4   = –4  – 4.75   = –4
The Easter Sunday Program Gauss derived a formula to determine the day (D) and month (M) on which Easter Day falls given the year (T). Let: k=   T/100  a = T modulo 19 b = T modulo 4 c = T modulo 7 q =   k/4  p =   (13 + 8k) / 25  m = (15 – p + k – q) modulo 30 d = (19a + m) modulo 30 n = (4 + k – q) modulo 7 e = (2b + 4c + 6d + n) modulo 7 Then D and M are determined as follows: If d + e ≤ 19 then D = 22 + d + e and M = 3 If d = 29 and e = 6 then D = 19 and M = 4 If d = 28 and e = 6 and a > 10 then D = 18 and M = 4 Otherwise, D = d + e – 9 and M = 4. Write a program which reads the year T and outputs the date of Easter in a readable form, e.g. 03/29.

02 11 Easter Sunday

  • 1.
    The Easter SundayProblem Venkatesh Ramamoorthy 11-Feb-2005
  • 2.
    Floor of avariable  x  = The greatest integer less than, or equal to x Examples  3  = 3  3.5  = 3  –4  = –4  –4.75  = –5
  • 3.
    Ceiling of avariable  x  = The smallest integer greater than, or equal to x Examples  3  = 3  3.5  = 4  – 4  = –4  – 4.75  = –4
  • 4.
    The Easter SundayProgram Gauss derived a formula to determine the day (D) and month (M) on which Easter Day falls given the year (T). Let: k=  T/100  a = T modulo 19 b = T modulo 4 c = T modulo 7 q =  k/4  p =  (13 + 8k) / 25  m = (15 – p + k – q) modulo 30 d = (19a + m) modulo 30 n = (4 + k – q) modulo 7 e = (2b + 4c + 6d + n) modulo 7 Then D and M are determined as follows: If d + e ≤ 19 then D = 22 + d + e and M = 3 If d = 29 and e = 6 then D = 19 and M = 4 If d = 28 and e = 6 and a > 10 then D = 18 and M = 4 Otherwise, D = d + e – 9 and M = 4. Write a program which reads the year T and outputs the date of Easter in a readable form, e.g. 03/29.