Friday 24 June 2016

C++ Program - To find Leap Year or Not

#include
using namespace std;
int main() {
    int year;
    cout << "Enter a year: ";
    cin >> year;
    if (year%4 == 0) {
        if (year%100 == 0) {
            if (year%400 == 0) {
                cout << year << " is a leap year.";
            } else {
                cout << year << " is not a leap year.";
            }
        } else {
            cout << year << " is a leap year.";
        }
    } else {
        cout << year << " is not a leap year.";
    }
    return 0;
}




No comments:

Post a Comment

CakePHP Date Picker

Folder Structure: Controller:   File location - cakephp/src/controller/HomepageController.php namespace App\Controller; use...