|
-
Dec 19th, 2000, 07:14 AM
#1
Thread Starter
New Member
Change of plan, begginer seiks help
Can you write a pgm that will use this algorithm to find the day of the week from any date between the 1st January 1800 and the 31st December 1999
1 Take the last two digits of the year
2 add a quarter of this neglecting any remainder
3 add the day of the month
4 for January add 1 (if a leap year add 0)
february add 4 (if a leap year add 3)
march add 4
april add 0
may add 2
june add 5
july add 0
august add 3
september add 6
october add 1
november add 4
december add 6
5 for 1800 - m1899 add 2
1900 onwards add 0
6 divide the result by 7 and the remainder gives the day of the week
1= sunday 2 = monday 3 = tuesday 4 = wednesday 5 =
thursday 6 = friday 7 = saturday
write a pgm that will accept the date in dd:mm:yyyy then using the above method calculate which day of the week it falls on and display this date
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|