C program to check leap year or not.

#include<stdio.h>
#include<conio.h>
void main()
{
 clrscr();
 int yr;
 printf("Enter year :");
 scanf("%d",&yr);
 if((yr%4==0) && (yr%100!=0))
 {
  printf("This is a Leap Year");
 }
 else if((yr%100==0) && (yr%400==0))
 {
  printf("This is a Leap Year");
 }
 else if(yr%400==0)
 {
  printf("This is a Leap Year");
 }
 else
 {
  printf("This is not a Leap Year");
 }
 getch();
}
C program to check leap year or not. C program to check leap year or not. Reviewed by on December 22, 2019 Rating: 5

No comments:

Powered by Blogger.