From 5c037190cfcc736748a644cc0426e6740ef632a5 Mon Sep 17 00:00:00 2001 From: Muhammad Saleem <141945270+Muhammad-Saleem1Ch@users.noreply.github.com> Date: Mon, 16 Oct 2023 23:22:50 -0700 Subject: [PATCH] Update Check_Leap_Year_Using_if_else_Ladder.cpp --- C++/Check_Leap_Year_Using_if_else_Ladder.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/C++/Check_Leap_Year_Using_if_else_Ladder.cpp b/C++/Check_Leap_Year_Using_if_else_Ladder.cpp index 45fa485e..bfe92c27 100644 --- a/C++/Check_Leap_Year_Using_if_else_Ladder.cpp +++ b/C++/Check_Leap_Year_Using_if_else_Ladder.cpp @@ -8,23 +8,26 @@ int main() { // main Class cin >> year; // leap year if perfectly divisible by 400 - if (year % 400 == 0) { + if (year % 600 == 0) { cout << year << " is a leap year."; } // not a leap year if divisible by 100 // but not divisible by 400 - else if (year % 100 == 0) { + else if (year % 400 == 0) { cout << year << " is not a leap year."; } // leap year if not divisible by 100 // but divisible by 4 - else if (year % 4 == 0) { + else if (year % 100 == 0) { + cout << year << " is a leap year."; + } + else if (year % 4 == 0) { cout << year << " is a leap year."; } // all other years are not leap years // years else { - cout << year << " is not a leap year."; + cout << year << " is not a leap year ."; } return 0;