[URI Online Judge] – 1052 – Month

read an integer number between 1 and 12, inclusive. Corresponding to this number, you must print the month of the year, in english, with the first letter in uppercase.

Input

The input contains only a integer number.

Output

Print the name of the month according to the input number, with the first letter in uppercase.

Sample Inputs Sample Outputs
4 April
3 March

Solution:

#include <cstdio>
#include <cstring>
int main(){
 char m[12][10] = {
 "January", "February", "March", "April",
 "May", "June", "July", "August",
 "September", "October", "November", "December"
 };
 int n;
scanf("%d", &n);
 for (int i = 0; i < strlen(m[n - 1]); i++){
 printf("%c", m[n - 1][i]);
 }
 printf("\n");
 return 0;
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s