I want to write a program to determine the day of the week a person was born,given his or her birth date,using the following steps to find the day of the week corresponding to any date in this century.
(a.) Divide the last two digits of the birth year by 4. Put the qoutient (ignoring the remainder)in Total. For example,if the person was born in 1983,divide 83 by 4 and store 20 in Total.
(b.) Add the last two digits of the birth year to Total.
(c.) Add the last two digits of the date of birth to Total.
(d.) Using the following table,find the "month number" and add it to Total:
January = 1 July = 0
February = 4 August = 3
March = 4 September = 6
April = 0 October = 1
May = 2 November = 4
June = 5 December = 6
(e.) If the year is a leap year and if the month is either January or February then subtract 1 from the Total.
(f.) Find the remainder when Total is divided by 7. Look up the remainder in the following table to determine the day of the week the person was born. Of course the procedure cannot be used if the person's date of birth is before 1900.
1= Sunday ,2= Monday ,3 = Tuesday,
4= Wednesday , 5 = Thursday, 6 = Friday, 0 = Saturday.
A typical line of date is 5-15 78 where the first entry (5-15) represents the birthdate (May 15) and the second entry represents the birth year. An appropriate errror message should be printed if a person's year of birth is before 1900.
This is a pascal program.