Program
#include <stdio.h>
int main()
{
int year;
printf("************************************************************");
printf("\n************************************************************");
printf("\n** WAP to check whether a year is leap year or not in C **");
printf("\n** Created by Sheetal Garg **");
printf("\n** Assistant Professor **");
printf("\n** Phone No:9467863365 **");
printf("\n************************************************************");
printf("\n************************************************************");
printf("\nenter the year\n");
scanf("%d", &year);
if (year % 100 == 0)
{
if (year % 400 == 0)
printf("year is leap year\n");
else
printf("year is not leap year\n");
}
else
{
if (year % 4 == 0)
printf("year is leap year\n");
else
printf("year is not leap year\n");
}
}
Output 1
************************************************************ ************************************************************ ** WAP to check whether a year is leap year or not in C ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************ ************************************************************ enter the year 1996 year is leap year
Output 2
************************************************************ ************************************************************ ** WAP to check whether a year is leap year or not in C ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************ ************************************************************ enter the year 1997 year is not leap year
Output 3
************************************************************ ************************************************************ ** WAP to check whether a year is leap year or not in C ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************ ************************************************************ enter the year 2000 year is leap year
Output 4
************************************************************ ************************************************************ ** WAP to check whether a year is leap year or not in C ** ** Created by Sheetal Garg ** ** Assistant Professor ** ** Phone No:9467863365 ** ************************************************************ ************************************************************ enter the year 1900 year is not leap year