87: Program to check whether a year is a leap year or not. Using switch statement
// Program to check whether a year is a leap year or not. Using switch statement
#include <iostream>
using namespace std;
int main()
{
int year;
cout << "Enter the year: ";
cin >> year;
switch (year % 4 == 0 && year % 100 == 0)
{
case 1:
cout << year << " is a leap year";
break;
case 0:
cout << year << " is not a leap year";
break;
default:
cout << "Invalid Input";
break;
}
return 0;
}
Comments
Post a Comment