Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main() {
- int yearInput;
- std::cout << "Please input a year:\n";
- std::cin >> yearInput;
- if (yearInput < 1000 && yearInput > 9999){
- if (yearInput % 4 == 0 && yearInput & 100 != 0 && yearInput == 400){
- std::cout << "The year " << yearInput << " is a leap year.\n";
- }else {
- std::cout << "The year " << yearInput << " is not a leap year.\n";
- }
- }else {
- std::cout << yearInput << " is an invalid year\n";
- }
- }
Add Comment
Please, Sign In to add comment