0

Can anyone help writing this program?

According to Gregorian calendar it was Monday on the date 01/01/01. If any year is input through keyboard write a program to find out what is the day on 1st Jan of this year?

25th Sep 2020, 6:05 AM
Sushant Gadge
2 ответов
+ 2
You can choose a reference year, and just shift the days from that. Don't forget the effect of leap years. Check your calendar and look at the pattern.
25th Sep 2020, 6:13 AM
Zerokles
Zerokles - avatar
0
Hi Sushant, while Zerokles is right, I just want to drop, that there is a known rule for coding with dates and stuff: "Never do it by yourself! You're guaranteed to mess it up." Find a deeper insight here: https://www.youtube.com/watch?v=-5wpm-gesOY Use a library which helps you. There is one for your language of choice, I guess. If that's a school or learning task, then, of course, do it yourself and learn from it :-) Have a nice day.
25th Sep 2020, 6:43 AM
Zen Coding
Zen Coding - avatar