Ayear in the modern gregorian calendar consists of 365 days. in reality, the earth takes longer to rotate around the sun. to account for the difference in time, every 4 years, a leap year takes place. a leap year is when a year has 366 days: an extra day, february 29th. the requirements for a given year to be a leap year are: the year must be divisible by 4if the year is a century year (1700, 1800, the year must be evenly divisible by 400some example leap years are 1600, 1712, and 2016.write a program that takes in a year and determines whether that year is a leap year. ex: if the input is 1712, the output is: 1712 is a leap year. ex: if the input is 1913, the output is: 1913 is not a leap year.
// program in C.
// main function
printf("Enter a year : ");
// read year
// check leap year
if((y % 4 == 0 && y % 100 != 0) || (y % 400 == 0))
printf("%d is leap year.",y);
printf("%d is not a leap year.",y);
Read year from user and assign it to variable "y".If year is divisible by 4 and not divisible by 100 or year is divisible by 400 then year is leap year otherwise year is not a leap year.
Enter a year : 2009
2009 is not a leap year.