class ZellersCongruence { /** * Calculate day of week using Zeller's Congruence * * For the Gregorian calendar * h =(q + floor(13(m + 1) / 5) + K + floor(K / 4) + floor(J/ 4) + 5J) % 7 * * For Julian calendar * h =(q + floor(13(m + 1) / 5) + K + floor(K / 4) + 5 + 6J) % 7 * * where * h is the day of the week (0 = Saturday, 1 = Sunday, 2 = Monday, ...) * q is the day of the month * m is the month (3 = March, 4 = April, 5 = May, ..., 14 = February) * K the year of the century (year % 100). * J is the century (actually floor(year/100)) (For example, in 1995 the century would be 19, even though it was the 20th century.) * * NOTE: In this algorithm January and February are ...
import javax.swing.JOptionPane; public class MagicOf9 { public static void main(String[] args) { String msg = "Think and write somewhere n digit number, \n" + "note that all digits must be unique \nfor e.g. for three" + " digit number I am assuming 123, \nwhere 1, 2, and 3 are " + "different and unique digits. \nNow add all the digits in " + "the number \nfor e.g. in our case it is 1 + 2 + 3. \nThe sum " + "is 6. \nNow subtract this resultant (i.e. 6 in this example) \n" + "from the supposed number. \nEnter your any (n - 1) digits like \n" + ...
Comments
Post a Comment
Post Your Valuable Comments