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.
Answers
Answer:
If year is divisible by 100 then it should be divisible by 400 for being a leap year other wise Year should be divisicle by 4 for being a leap year.
Step-by-step explanation:
Start
Input number
Y = Number
if ( 10000 > Y > 999 )
{
if Y % 100 = 0
{
if Y % 400 = 0
{
Print Y is a "Leap Year".
}
Else
{
Y is "Not a Leap Year"
}
}
Elseif ( Y % 4 = 0)
{
Print Y is a "Leap Year".
}
Else
{
Y is "Not a Leap Year"
}
}
Else
{
Print "Invalid Year"
}
End
Answer:
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
Step-by-step explanation:
https://www.clashcoder.tech/2020/05/check-for-leap-year-program-in-java.html