Write program to input year and check year is leap or not.
In this program we input an year and check year is leap or not, that means we input a year by user and then he find Leap year if condition is true else Not leap year.
As we know leap year means that year which divided by 4. In program we write a condition that if year fully divided by 4 then Leap year else Not leap year.
Let's Begin --
#include<stdio.h>
#include<conio.h>
void main()
{
int y;
clrscr();
printf("Enter a year=");
scanf("%d",&y);
if(y%4==0)
printf("\nLeap year");
else
printf("\nNot leap year");
getch();
}
As we know leap year means that year which divided by 4. In program we write a condition that if year fully divided by 4 then Leap year else Not leap year.
Let's Begin --
#include<stdio.h>
#include<conio.h>
void main()
{
int y;
clrscr();
printf("Enter a year=");
scanf("%d",&y);
if(y%4==0)
printf("\nLeap year");
else
printf("\nNot leap year");
getch();
}
OUTPUT
Enter a year=2001
Not leap year
OR
Enter a year=2016
Leap year
Related Examples
- Write a program to input a number and check number is odd or even.
- Write a program to input two number and find smallest number.
- Write a program to input two number and find highest number.
Share and Comment. Follow for recently updates.
Comments
Post a Comment