C++ program to check whether given year is Leap year or not.

#include<iostream.h> 
#include<conio.h> 
void main(){               
int year;             
clrscr();             
cout<<"Enter a year"<<endl;             
cin>>year;                 
if(year%400==0)
cout<<year<<" is a leap year"<<endl;           
else{
if(year%100==0)
cout<<year<<" is not a leap year"<<endl;           
else{
if(year%4==0)
cout<<year<<" is a leap year"<<endl;         
else
cout<<year<<" is not a leap year"<<endl;
}
}
getch();
}

No comments:

Post a Comment