Computer Science, asked by kjemmanu206, 1 year ago

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

Answered by LuckyYadav2578
3

In Python

Leap year programme

y = int (input ( " Enter Year "))

a = len (y)

if a == 4:

____if ( y%400==0) or (y % 4 ==0 and y%100 != 0) :

________print (" Leap year")

____else :

________print (" Not a leap year ")

else:

____print (" Invalid year ")

About some function that I am using in programme

int () - For integer number.

len () - Use to find the length.

print () - Use to print the message.

note : I am using '___' these line for indentation (space ) imagine it invisible.

Similar questions