Structure of the Problem Requirements
In this problem we will learn how to find leap year in C++ program . In Gregorian calendar there are three requirements for leap year .
1. The Year is Divisible by 4.
2. The Year is Divisible by 100.
3. The Year is Divisible by 400.
All these requirements must be fulfil to prove a year a Leap Year . Here is the source code of this problem which help you in better understanding.
Source Code
#include<iostream>
using namespace std;
int main ()
{
int year;
cout<<" \t \t \t Find Leap Year \n \n ";
cout<<" Enter the Four Digit of Year : ";
cin>>year;
cout<<endl<<endl;
if ( year%4 == 0 || year%400 == 0 || year%100 == 0)
{
cout<<"\t \t Yes! The Year "<<year <<" is a Leap Year "<<endl;
}
else
{
cout<<"\t \t No! The Year "<<year <<" is Not a Leap Year "<<endl;
}
}
Output of the Program
Asad Niazi is Software Engineer , Programmer, Web Developers and a young mentor of Tech Solutions Desk and Blogging Solutions . Asad Love to writes about Technology, Programming, Blogging and make money online.
thanks stranger for your interest . Dear we just build leap year program logic and explain it with few words .. Definitely Wikipedia has rich content about it. keep visiting
ReplyDelete