Check leap year using conditional Operator with C language
#include <stdio.h>
int main()
{
int year;
printf("Enter any year: ");
scanf("%d", &year);
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
{
printf("LEAP YEAR");
}
else
{
printf("NOT LEAP YEAR");
}
return 0;
}
Output:-
Enter any year : 2019
NOT LEAP YEAR
0 Comments