Thursday, 12 February 2015

C plus plus Program to Find if a given Year is a Leap Year

Leave a Comment
Code:-

#include<iostream>
using namespace std;
void main()
{
int year;
cout<<"Enter a year to check leap year =  ";
cin>>year;
if(year%4==0&&year%400==0)
{
cout<<"The year is a leap year (it has 366 days)."<<endl;
}
else
cout<<"The year is not a leap year (it has 365 days)"<<endl;
}

Output;-


If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: