Created
April 14, 2013 12:57
-
-
Save simplement-e/5382628 to your computer and use it in GitHub Desktop.
Obtient le jour de Pâques d'une année donnée / get easter day for a given year
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static DateTime JourDePaques(int year) | |
| { | |
| int a, b, C, P, E, F, g, h, i, K, N, Y, r, M, D; | |
| Y = year; | |
| a = fmod(Y, 19); | |
| b = (int)(Y / 100); | |
| C = fmod(Y, 100); | |
| P = (int)(b / 4); | |
| E = fmod(b, 4); | |
| F = (int)((b + 8) / 25); | |
| g = (int)((b - F + 1) / 3); | |
| h = fmod(19 * a + b - P - g + 15, 30); | |
| i = (int)(C / 4); | |
| K = fmod(C, 4); | |
| r = fmod(32 + 2 * E + 2 * i - h - K, 7); | |
| N = (int)((a + 11 * h + 22 * r) / 451); | |
| M = (int)((h + r - 7 * N + 114) / 31); | |
| D = fmod(h + r - 7 * N + 114, 31) + 1; | |
| return new DateTime(year, M, D); | |
| } | |
| private static int fmod(int a, int b) | |
| { | |
| return (a - b * (int)(a / b)); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment