Answer the question
In order to leave comments, you need to log in
How to understand this code, what do the numbers mean?
// Вычисление дня недели для 1 января
int week = (year + (year - 1) / 4 + 6) % 7;
Answer the question
In order to leave comments, you need to log in
Is it really easier to write a post here than to google it?
For example
This is obviously the formula for calculating "the day of the week for January 1st".
Substitute the year, for example 2021 - you get the number 5 - i.e. The first of January this year was on a Friday.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question