write a c program to check leap year,how to leap year in c,write a c program to check whether a year is leap year or not,leap year program in c,write a program to check if the year entered by the user is a leap year or not
leap year program in c using if else
#include<stdio.h>
#include<conio.h>
void main()
{
int year;
clrscr();
printf("Enter the year: ");
scanf("%d",&year);
if(year%4==0&&year%100!=0||year%400==0)
printf("%d is a leap year",year);
else
printf("%d is not a leap year",year);
getch();
}
Output:
run 1:
Enter the year: 2020
2020 is a leap year
run 2:
Enter the year: 2021
2021 is not a leap year
No comments: