Created
February 15, 2022 12:06
-
-
Save CodeMaster7000/5ba21b7c161f1e0a733b4e722c88e873 to your computer and use it in GitHub Desktop.
A program coded in C++ which checks whether the input year is a leap year or not.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() { | |
int year; | |
cout << "Enter a year: "; | |
cin >> year; | |
if (year % 400 == 0) { | |
cout << year << " is a leap year."; | |
} | |
else if (year % 100 == 0) { | |
cout << year << " is not a leap year."; | |
} | |
else if (year % 4 == 0) { | |
cout << year << " is a leap year."; | |
} | |
else { | |
cout << year << " is not a leap year."; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment