Pages

Wednesday, 7 February 2018

Any year is entered through the keyboard, write a program to determine whether the year is leap or not. Use the logical operators && and ||.

Any year is entered through the keyboard, write a program to determine whether the year is leap or not. Use the logical operators && and ||.

 #include<iostream>
 using namespace std;
#include<conio.h>
int main()
{
  int year;

  cout<<"enter any year : ";
  cin>>year;
  if((year%4==0&&year%100!=0)||year%400==0)
  {
    cout<<year<<" is a Leap Year.";
  }
  else
  {
    cout<<year<< "is not a Leap Year";
  }
  getch();
  return 0;
}