You are on page 1of 1

10. Write a program to check if a year is leap year or not.

Sol:

#include <iostream>
using namespace std;
int main()
{
int x;
cout<<"Please Enter a Year: ";
cin>>x;
if (x%4==0 && x%100!=0)
{
cout<<x<<" is a Leap Year";
}
else if (x%100==0 || x%400!=0)
{
cout<<x<<" is not a Leap Year";
}
else if(x%400==0)
{
cout<<x<<"is a leap Year";
}
cout<<"\n";
}

You might also like