C++ Program to Check Leap Year














































C++ Program to Check Leap Year



A year is leap year if the following conditions are satisfied: 1.Year is multiple of 400. 2.Year is multiple of 4 and not multiple of 100.

#include<iostream> using namespace std;
// Function to Check Leap Year bool leapYear(int year) { if(year % 400 == 0) return true; if(year % 100 == 0) return false; if(year % 4 == 0) { return true; } else { return false; } } int main() { int year = 2000; leapYear(year) ? cout << year << " is a Leap year ":   cout << year << " is not a Leap year "; return 0; }


OUTPUT : 2000 is a Leap year

Comments