C Program to find Leap year using conditional operator
#include<stdio.h>
int main()
{
int year;
printf("Enter any Year: ");
scanf("%d",&year);
(year%4 == 0 && year%100 != 0) ? printf("%d is Leap Year", year)
: (year%400==0) ? printf("%d is Leap Year", year) : printf("%d is Common Year", year);
return 0;
}
Output
Enter any Year: 2020
2020 is Leap Year