Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed

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_start

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Programming The Perl DBI Database Programming With Perl

Authors: Tim Bunce, Alligator Descartes

1st Edition

1565926994, 978-1565926998

More Books

Students also viewed these Databases questions

Question

=+3. Who is responsible for this project?

Answered: 1 week ago