/*C++ program to check Leap year*/
/*C++ program to check whether entered year is Leap year or not*/
#include
using namespace std;
int main()
{
int year;
//Label to run again program from here
INIT:
//input a year
cout<<"\nEnter year (ENTER 0 for exit...): ";
cin>>year;
/*
if( (year%100!=0 && year%4==0) || (year%400==0) )
cout<<year<<" is a Leap year."<<endl;
else
cout<<year<<" is not a Leap year."<<endl; */
//using TERNARY OPERATOR/CONDITIONAL OPR/?: OPR
( (year%100!=0 && year%4==0) || (year%400==0) ) ?
cout<<year<<" is Leap year."<<endl :
cout<<year<<" is not a Leap year."<<endl;
//condition to go to label INIT or end of the program
if(year!=0)
goto INIT;
return 0;
}