LEAP YEAR Question- A story behind use of 4, 100 and 400
"Reason behind the use of 4,100 and 400 numbers in leap year flowchart or programming question"
Two months back I was solving the assignment sets that were assigned to me in class and I was solving the question of leap year. As I always do I broke down the problem into pieces and divided it into three parts;
First: Write some code to take input year
Second: Find what exactly is leap year.
third: Write the code to find the leap from the input year.
Fourth: Just End
I found out that leap year is the year which is repeated every four years. It is done to compensate for the extra days that is 365_1/4 days. I thought I got it but I was wrong

Can you see there are extra test cases of division by 100 and another division by 400? I was like; I understand the presence of division by 4 but why there is division by 100 and again by 400? That put me into deep thinking.
If you still here reading this blog lets deep into the history of calendars;
| BC (Before Christ) | |
| Started on | 100 BC |
| Ended on | 1 BC |
| THERE IS NO PRESENCE OF 0 AD OR 0 BC | |
| AD (Anno Domini) | |
| Started on | 1 AD |
| ongoing | 2023 AD |
Let's dive into the AD calendar:
So till we came to know How the calendar is established or made. As a fun fact, I will like to share that Nepal has a different calendar the year now is 2079 BS. That means Nepalese people are living just 57 years ahead of the English calendar. although the development and its infrastructure are no futuristics the beauty of nature is more than 57 years valuable.
Let's come back to the topic;
since the beginning of 1 AD people had different calendar views there was some social issue(related to religious biases) also. So that resulted in different views towards the calendar and started to formulate new ideas for the calendar.
We use numbers 4, 100, and 400 to calculate a program to find out leap years because they are used to determine the rules for a leap year according to the Gregorian calendar.
A year is a leap year if it is divisible by 4. This is because the Earth's orbit around the sun takes approximately 365.25 days, so every four years an extra day (February 29th) is added to the calendar to keep the calendar in sync with the orbit.
However, there is an exception to this rule. Years that are divisible by 100 are not leap years, but years that are divisible by 400 are leap years. This is because the orbit of the Earth is not exactly 365.25 days, but slightly less. Adding an extra day every four years would cause the calendar to drift too far from the actual orbit, so the rule was adjusted to exclude years that are divisible by 100 but include years that are divisible by 400.
So, we use 4, 100 and 400 to find out the leap year because these numbers are used to determine leap years as per the rules of the Gregorian calendar.
Yeah this is it for the question if you want to know little more detail about second bullets follow this quoar link;