Question
Find number of days in the month - clone Given an integer N as an input, where N indicates the number of the month in
Find number of days in the month - clone
Given an integer N as an input, where N indicates the number of the month in a Gregorian year. e.g.1represents "January",2represents "February" and vice versa.
Month numbers 1, 3, 5, 7, 8, 10 and 12 represent Jan, Mar, May, Jul, Aug, Oct, and Dec. These months have 31 days, so display31for them.
Month numbers 4, 6, 9 and 11 represent Apr, Jun, Sep, and Nov. These months have 30 days, so display30for them.
Month number 2 represents Feb, which has 27 or 28 days, so regardless of the leap years display27for Feb.
Input:
1
where:
Input is a month number.
Output:
31
Explanation:As 1 represents the month of January and it has 31 days, so the output is "31".
Assumption:
Month number can be in the range 1 to 12.
Write a python program about this question
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started