Skip to content
doubtly

1 answer

Best answer

#include <iostream>

using namespace std;


int main()

 {

    int year;


    cout << "Enter a year to check: ";

    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;

}



Output::
image


image

Doubtly · 8 Nov 2021 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.