This C++ Program Checks Whether the Entered Year is a Leap Year or Not.
One year has the length of 365 days, 5 hours, 48 minutes and 45 seconds.This is hard to calculate with, so a normal year has been given 365 days and a leap year 366 days.In leap years, February 29th is added as leap day, which doesn’t exist in a normal year. A leap year is every 4 years, but not every 100 years, then again every 400 years.
Here is source code of the C++ Program to Check Whether the Entered Year is a Leap Year or Not.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#include <iostream> using namespace std; int main() { int year; cout<<"Enter a year: "<< endl; cin>> year; if((year % 4) ==0) { cout<<" Leap Year "; } else { cout <<" Not a Leap Year" << endl; } return 0; } /* Enter a year: 2016 Leap Year */ |