Question
Need Help with Explanation I'm currently calendar building and the only problem I had was placing the numbers in the correct spot. I looked up
Need Help with Explanation
I'm currently calendar building and the only problem I had was placing the numbers in the correct spot. I looked up this function and it seems to do the job. Can someone please explain why it is that when the year is entered, why is it that through this equation the numbers are placed in the right spot? I guess it's more of an arithmetic question but I'm having brain farts as to why 3 year variables are subtracted by 1, divided by 4, 100, and 400 and then year + v1-v2+v3 then you take the remainder after divided by 7. I just started coding and I LOVE IT! If someone would please take the time to explain this that would help me out. Thank you
int firstDayofnewyearMonth(int year) int day_start; int x1, x2, x3,; x1 (year - 1)/ 4; x2(year 1)/ 100; x3(year - 1)/ 400 day-start- (year + x1 x2 + x3) %7 ; return day_startStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started