227k views
3 votes
**NEEDS TO BE PSEUDOCODE/ CORAL LANGUAGE**

A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are:

1) The year must be divisible by 4

2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400

Some example leap years are 1600, 1712, and 2016.

Define a function called OutputLeapYear that takes an integer as a parameter, representing a year, and output whether the year is a leap year or not. Then, write a main program that reads a year from a user, calls function OutputLeapYear() with the input as argument to determines whether that year is a leap year.

Ex: If the input of the program is:

1712
the output is:

1712 is a leap year.
Ex: If the input of the program is:

1913
the output is:

1913 is not a leap year.
Your program must define and call a function:
Function OutputLeapYear(integer inputYear) returns nothing

User BobRock
by
8.3k points

1 Answer

2 votes

Step-by-step explanation:

// Pseudocode for function OutputLeapYear

function OutputLeapYear(inputYear):

if (inputYear % 4 == 0 and inputYear % 100 != 0) or (inputYear % 400 == 0):

print(inputYear + " is a leap year.")

else:

print(inputYear + " is not a leap year.")

return

// Pseudocode for main program

function main():

year = input("Please enter a year: ")

OutputLeapYear(year)

return

// Example usage of the program

main() // User inputs 1712

// Output: 1712 is a leap year.

main() // User inputs 1913

// Output: 1913 is not a leap year.

User Susmits
by
8.3k points