Saturday, September 29, 2018

Write a program to determine whether the year is a leap year or not in C++?

#include<iostream.h>
#include<stdio.h>
#include<conio.h> 
int main()
{
 int year;

 cout<<"Enter the year : ";
 cin>>year;

 if( (year%400==0 || year%100!=0) &&(year%4==0))
  cout<<"It is a leap year";
 else
  cout<<"It is not a leap year";


 return 0;
}

No comments:

Post a Comment