You are viewing a single comment's thread. Return to all comments →
My Java solution:
public static String dayOfProgrammer(int year) { StringBuffer buf = new StringBuffer(); int day = 13; if (year == 1918) { day = 26; } else if (year < 1918) { if (isJulianLeapYear(year)) day-=1; } else if (year > 1918) { if (isGregorianLeapYear(year)) day-=1; } buf.append(day + ".09." + year); return buf.toString(); } private static boolean isJulianLeapYear(int year) { if (year % 4 == 0) return true; return false; } private static boolean isGregorianLeapYear(int year) { if ((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)) return true; return false; }
Seems like cookies are disabled on this browser, please enable them to open this website
Day of the Programmer
You are viewing a single comment's thread. Return to all comments →
My Java solution: