Skip to main content

Programming using Java Hands On - Control Structures | Check for Leap Year

 Given a year, check if the year is leap year or not. If yes, the output should be “Leap Year”.  Else output should be “Not a Leap Year”.  The input should be a positive four digit number.  Else,  the output should be “Invalid Year”.

Sample Input  1 :

Enter the Year

2016

Sample Output  1 :

Leap Year


Sample Input  2 :

Enter the Year

2001

Sample Output  2 :

Not a Leap Year

Given a year, check if the year is leap year or not. If yes, the output should be “Leap Year”.  Else output should be “Not a Leap Year”.  The input should be a positive four digit number.  Else,  the output should be “Invalid Year”.  Sample Input  1 :  Enter the Year  2016  Sample Output  1 :  Leap Year    Sample Input  2 :  Enter the Year  2001  Sample Output  2 :  Not a Leap Year


Result Description

Summary of tests
*Note: All the test cases might not have same weightage
+------------------------------+
| 12 tests run/12 tests passed |
+------------------------------+

Comments