wes d2a2ba9e15 first commit 4 years ago
..
README.md d2a2ba9e15 first commit 4 years ago
code.cpp d2a2ba9e15 first commit 4 years ago
unitTest.cpp d2a2ba9e15 first commit 4 years ago

README.md

Convert Number to Corresponding Month Name

by Helen Yu tags: arrays, dates, conditions, formatting

Summary

Create a function that takes a number (from 1 to 12) and returns its corresponding month name as a string. For example, if you're given 3 as input, your function should return "March", because March is the 3rd month. Number | Month Name --- | --- 1 | January 2 | February 3 | March 4 | April 5 | May 6 | June 7 | July 8 | August 9 | September 10 | October 11 |

Instructions

Create a function that takes a number (from 1 to 12) and returns its corresponding month name as a string. For example, if you're given 3 as input, your function should return "March", because March is the 3rd month.

Number Month Name
1 January
2 February
3 March
4 April
5 May
6 June
7 July
8 August
9 September
10 October
11 November
12 December

Examples

monthName(3) ➞ "March"

monthName(12) ➞ "December"

monthName(6) ➞ "June"

Notes

  • You can expect only integers ranging from 1 to 12 as test input.
  • If you get stuck on a challenge, find help in the Resources tab.
  • If you're really stuck, unlock solutions in the Solutions tab.