Any year is entered through the keyboard. Write a function to determine whether the year is a leap year or…