Write a program to check whether entered year is a leap year or not.
#include<stdio.h> int main() { int year; printf("Enter Year : "); scanf("%d",&year); if((year % 400 == 0) || (year%4 == 0 && year%100!=0)) printf("%d is Leapyear\n",year); else printf("%d is not Leapyear\n",year); return 0; }
Output
Enter Year : 2008 2008 is Leapyear Enter Year : 300 300 is not Leapyear Enter Year : 2017 2017 is not Leapyear