1.

C++ if and else programming Write a program to enter a year check whether leap year or not

Answer»

ANSWER:

#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;

}



Discussion

No Comment Found