Skip to content
Advertisement

Please help me use the selection description to write a program that displays the corresponding four seasons according to the month entered by the use [closed]

Please use the selection description to write a program that displays the corresponding four seasons according to the month entered by the user input Output: (one) Month 11 winter

Advertisement

Answer

Just convert the 12 for December to a 0, perform a floored division by 3 to get a number in the interval [0, 3], then use that number as an index for the different seasons.

You can replace “Autumn” with “Fall” depending on your dialect.

JavaScript

Example:

JavaScript
Advertisement