URI Online Judge Solution 1052 Month – Solution in C, C++, Java, Python and C#
URI Online Judge Solution 1052 Month| Beginner
URI Problem Link – https://www.urionlinejudge.com.br/judge/en/problems/view/1052
Problem Name: 1052 Month
Problem Number : URI – 1052 Month
Online Judge : URI Online Judge Solution
Category: Beginner
Solution Language : C,C plus plus, java, python, c#(c sharp)
URI 1052 Month Code in C / URI 1052 solution in C:
Using Switch case:
#include<stdio.h>
int main()
{
int N;
scanf("%d", &N);
switch (N)
{
case 1:
printf("Januaryn");
break;
case 2:
printf("Februaryn");
break;
case 3:
printf("Marchn");
break;
case 4:
printf("Apriln");
break;
case 5:
printf("Mayn");
break;
case 6:
printf("Junen");
break;
case 7:
printf("Julyn");
break;
case 8:
printf("Augustn");
break;
case 9:
printf("Septembern");
break;
case 10:
printf("Octobern");
break;
case 11:
printf("Novembern");
break;
case 12:
printf("Decembern");
break;
default:
break;
}
}
Using simple if-else
#include<stdio.h>
int main()
{
int N;
scanf("%d", &N);
if(N == 1) printf("Januaryn");
else if (N == 2) printf("Februaryn");
else if (N == 3) printf("Marchn");
else if (N == 4) printf("Apriln");
else if (N == 5) printf("Mayn");
else if (N == 6) printf("Junen");
else if (N == 7) printf("Julyn");
else if (N == 8) printf("Augustn");
else if (N == 9) printf("Septembern");
else if (N == 10) printf("Octobern");
else if (N == 11) printf("Novembern");
else if (N == 12) printf("Decembern");
}
URI 1052 Month Code in C++ / URI 1052 solution in CPP:
#include <iostream>
using namespace std;
int main()
{
int d;
cin >> d;
if(d == 1){
cout << "January" << endl;
}else if(d == 2){
cout << "February" << endl;
}else if(d == 3){
cout << "March" << endl;
}else if(d == 4){
cout << "April" << endl;
}else if(d == 5){
cout << "May" << endl;
}else if(d == 6){
cout << "June" << endl;
}else if(d == 7){
cout << "July" << endl;
}else if(d == 8){
cout << "August" << endl;
}else if(d == 9){
cout << "September" << endl;
}else if(d == 10){
cout << "October" << endl;
}else if(d == 11){
cout << "November" << endl;
}else if(d == 12){
cout << "December" << endl;
}
return 0;
}
URI 1052 Month Code in java/ URI 1052 solution in Java:
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int N;
Scanner input =new Scanner(System.in);
switch (N =input.nextInt()) {
case 1:
System.out.print("Januaryn");
break;
case 2:
System.out.print("Februaryn");
break;
case 3:
System.out.print("Marchn");
break;
case 4:
System.out.print("Apriln");
break;
case 5:
System.out.print("Mayn");
break;
case 6:
System.out.print("Junen");
break;
case 7:
System.out.print("Julyn");
break;
case 8:
System.out.print("Augustn");
break;
case 9:
System.out.print("Septembern");
break;
case 10:
System.out.print("Octobern");
break;
case 11:
System.out.print("Novembern");
break;
case 12:
System.out.print("Decembern");
break;
default:
break;
}
}
}
URI 1052 Month Code in Python / URI 1052 solution in Python:
URI Solution 1052 Month Code / URI 1052 solution in C# (C Sharp):
Demonstration:
Just read the number and print the month. You can use simple if-else statement or switch-case statement to solve URI 1052 problem.
Just implement this in coding. Since having any problem just put a comment below. Thanks
Tags: URI Online Judge Solution, URI OJ Solution list, URI Problems Solution, URI solver, URI all problem solution list, URI 1052 Month code in C, URI 1052 Month code in C++, URI Month solution in C, URI solution, URI 1052 Month solution in C,URI 1052 solution in C++-CPP,URI 1052 solution in C# (C sharp),URI 1052 solution in Java,URI 1052 Month solution in Python, URI online judge 1052 problem solution, URI online judge Month problem solution