URI - BEECROWD - BEE 1052 - Month Solution in C,C++,Python | URI - BEECROWD - BEE Online Judge Solution 1052 - Month
Read an integer number between 1 and 12, including. Corresponding to this number, you must print the month of the year, in english, with the first letter in uppercase.
Input
Output
Print the name of the month according to the input number, with the first letter in uppercase.
Input Sample | Output Sample |
4 | April |
URI 1052 - Month Solution in C,C++,Python | URI Online Judge Solution 1052 - Month:
Demonstration:
It's a not a hard problem.You just have to check the conditions by using if-else to find the combination of the table given.Then you have to print those values according to the problem's statement..
Example:
There are twelve months in a year:
If Number is 5,Month name will be May!
N.B: Don't copy paste the code as same. Just try to understand it and try yourself. It would be better for you.
URI Problem 1052 Solution in C :
URI Online Judge 1052 Solve in C : |
#include<stdio.h>
int main()
{
int N;
scanf("%d", &N);
if(N == 1) printf("January\n");
else if (N == 2) printf("February\n");
else if (N == 3) printf("March\n");
else if (N == 4) printf("April\n");
else if (N == 5) printf("May\n");
else if (N == 6) printf("June\n");
else if (N == 7) printf("July\n");
else if (N == 8) printf("August\n");
else if (N == 9) printf("September\n");
else if (N == 10) printf("October\n");
else if (N == 11) printf("November\n");
else if (N == 12) printf("December\n");
return 0;
}
URI Problem 1052 Solution in C ++:
URI Online Judge 1052 Solve in C++ : |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
if(n==1){
cout<<"January"<<endl;
}else if(n==2){
cout<<"February"<<endl;
}else if(n==3){
cout<<"March"<<endl;
}else if(n==4){
cout<<"April"<<endl;
}else if(n==5){
cout<<"May"<<endl;
}else if(n==6){
cout<<"June"<<endl;
}else if(n==7){
cout<<"July"<<endl;
}else if(n==8){
cout<<"August"<<endl;
}else if(n==9){
cout<<"September"<<endl;
}else if(n==10){
cout<<"October"<<endl;
}else if(n==11){
cout<<"November"<<endl;
}else if(n==12){
cout<<"December"<<endl;
}
return 0;
}
URI Problem 1052 Solution in Python:
URI Online Judge 1052 Solve in Python : |
x=int(input())
if(x==1):
print("January")
elif(x==2):
print("February")
elif(x==3):
print("March")
elif(x==4):
print("April")
elif(x==5):
print("May")
elif(x==6):
print("June")
elif(x==7):
print("July")
elif(x==8):
print("August")
elif(x==9):
print("September")
elif(x==10):
print("October")
elif(x==11):
print("November")
elif(x==12):
print("December")
Previous Post:
0 Response to URI - BEECROWD - BEE 1052 - Month Solution in C,C++,Python | URI - BEECROWD - BEE Solution 1052 - Month
Post a Comment