Skip to content
This repository was archived by the owner on Jun 26, 2022. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions cpp/18EC10014_leap_ year_or _not.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
bool isLeapYear(int n)
{
if(n%400==0)
{
return 1;
}
else if(n%100==0)
{
return 0;
}
else if(n%4==0)
{
return 1;
}
}

int main()
{
int year;
cout<<"Enter the year ";
cin>>year;
if(isLeapYear(year))
{
cout<<"The year "<<year<<" is a leap year";
}
else
{
cout<<"The year "<<year<<" is not a leap year";
}
}