C program of leap year.
C program for leap year.
C program for leap year.This program will check whether given year is leap year or not.
- Take input from user.
- Divide it by 400 if it get divided then it is leap year.
- Again divide it by 100 if it get divided then it is not leap year.
- After that divide it by 4 if it get divided then it is leap year.
- If all the above condition has failed then it is not leap year.
C program for leap year
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int year;
printf("Enter year\n");
scanf("%d",&year);
if(year%400==0)
printf("It is leap year\n");
else
if(year%100==0)
printf("It is not leap year\n");
else
if(year%4==0)
printf("It is leap year\n");
else
printf("It is not leap year\n");
getch();
}
This program will print whether enter year is leap year or not.
C program of leap year.
Reviewed by Deepak kumar soni
on
December 30, 2018
Rating:
No comments: