Hello Here is C program to check If the year entered by user is century Year or not. First we check if the year is Century then check if it is leap or not. And for other check Leap year.
And I think you understand this code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<stdio.h>
main()
{
int year;
printf("Enter the Year you want to check:- ");
scanf("%d",&year);
if(year % 100 ==0)
{
if (year % 400 == 0)
printf("Century Leap Year");
else
printf("Not a leap year");
}
else
{
if(year % 4 == 0)
printf("Leap Year");
else
printf("Not a leap year");
}
}
|
And I think you understand this code.
