c 2b 2b code for leap year

Solutions on MaxInterview for c 2b 2b code for leap year by the best coders in the world

showing results for - "c 2b 2b code for leap year"
Florine
13 Jan 2017
1#include <iostream>
2using namespace std;
3
4int main() {
5    int year;
6
7    cout << "Enter a year: ";
8    cin >> year;
9
10    if (year % 4 == 0) {
11        if (year % 100 == 0) {
12            if (year % 400 == 0)
13                cout << year << " is a leap year.";
14            else
15                cout << year << " is not a leap year.";
16        }
17        else
18            cout << year << " is a leap year.";
19    }
20    else
21        cout << year << " is not a leap year.";
22
23    return 0;
24}