// Example 4.8. Program to test for leap year
#include
using namespace std;
int main()
{
int year; // year to test
cout << "Please enter a year: ";
cin >> year;
// if year is divisible by 4 AND not divisible by 100
// OR is divisible by 400, then it is a leap year
if ( ((year % 4 == 0) && (year % 100 != 0))
|| (year % 400 == 0))
cout << year << " is a leap year." << endl;
else
cout << year << " is not a leap year." << endl;
return 0;
}