Problem :
Month
Adapted by Neilor Tonin, URI Brazil
Timelimit: 1
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 <stdio.h>
int
main() {
int
a;
scanf
(
"%d"
,&a);
if
(a==1)
{
printf
(
"January\n"
);
}
else
if
(a==2)
{
printf
(
"February\n"
);
}
else
if
(a==3)
{
printf
(
"March\n"
);
}
else
if
(a==4)
{
printf
(
"April\n"
);
}
else
if
(a==5)
{
printf
(
"May\n"
);
}
else
if
(a==6)
{
printf
(
"June\n"
);
}
else
if
(a==7)
{
printf
(
"July\n"
);
}
else
if
(a==8)
{
printf
(
"August\n"
);
}
else
if
(a==9)
{
printf
(
"September\n"
);
}
else
if
(a==10)
{
printf
(
"October\n"
);
}
else
if
(a==11)
{
printf
(
"November\n"
);
}
else
if
(a=12)
{
printf
(
"December\n"
);
}
return
0;
}
No comments:
Post a Comment