How many days in a month? - MATLAB Cody - MATLAB Central

Problem 44437. How many days in a month?

Difficulty:Rate

Return the number of days in a given month in 2017. If the input is not a valid month number, return -1.

Examples:

Input: m = 1
Outpu: d = 31
Input:  m = 2
Output: d = 28
Input:  m = 13
Output: d = -1

You cannot use IF statements

Solution Stats

27.13% Correct | 72.87% Incorrect
Last Solution submitted on Mar 17, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8

Problem Recent Solvers488

Suggested Problems

More from this Author25

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!