View Code of Problem 28

#include <iostream>

using namespace std;

bool isLeapYear(unsigned int year) {
    if (year % 400 == 0 ||
        (year % 4 == 0 && year % 100 != 0))
        return true;
    else
        return false;
}

int main() {
    unsigned int year;
    while (cin >> year) {
        cout << (isLeapYear(year) ? "Leap Year\n" : "Not Leap Year\n");
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 28