Write a program for leap year using logical operators.
#include <iostream.h>
#include <conio.h>
void main()
{
int year;
clrscr();
cout<<"Enter year to check:";
cin>>year;
cout<<((year%400==0)||((year%100!=0)&&(year%4==0)))
? "Not Leap Year" : "Leap Year";
getch();
}
No comments:
Post a Comment