Advertisement
Naohiro19

Leap year / C++

Dec 30th, 2019
288
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.28 KB | None | 0 0
  1. bool is_leap_year(int year)
  2. {
  3.     bool bLeap = false;
  4.     if (year % 4 == 0) {
  5.         if (year % 100 == 0) {
  6.             if (year % 400 == 0) {
  7.                 bLeap = true;
  8.             }
  9.             else {
  10.                 bLeap = false;
  11.             }
  12.         }
  13.         else {
  14.             bLeap = true;
  15.         }
  16.     }
  17.     else {
  18.         bLeap = false;
  19.     }
  20.     return bLeap;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement