URI Online Judge Solution 1052 Month - Solution in C, C++, Java, Python and C# - Online Judge Solution

Latest

It is a free Online judges problems solution list. Here you can find UVA online Judge Solution, URI Online Judge Solution, Code Marshal Online Judge Solution, Spoz Online Judge Problems Solution

Thursday, July 13, 2017

URI Online Judge Solution 1052 Month - Solution in C, C++, Java, Python and C#

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 Online Judge Solution 1052 Month - Solution in C, C++, Java, Python and C#

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("January\n");
        break;
    case 2:
        printf("February\n");
        break;
    case 3:
        printf("March\n");
        break;
    case 4:
        printf("April\n");
        break;
    case 5:
        printf("May\n");
        break;
    case 6:
        printf("June\n");
        break;
    case 7:
        printf("July\n");
        break;
    case 8:
        printf("August\n");
        break;
    case 9:
        printf("September\n");
        break;
    case 10:
        printf("October\n");
        break;
    case 11:
        printf("November\n");
        break;
    case 12:
        printf("December\n");
        break;

    default:
        break;
    }
}


Using simple if-else

#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");

}


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("January\n");
   break;
  case 2:
   System.out.print("February\n");
   break;
  case 3:
   System.out.print("March\n");
   break;
  case 4:
   System.out.print("April\n");
   break;
  case 5:
   System.out.print("May\n");
   break;
  case 6:
   System.out.print("June\n");
   break;
  case 7:
   System.out.print("July\n");
   break;
  case 8:
   System.out.print("August\n");
   break;
  case 9:
   System.out.print("September\n");
   break;
  case 10:
   System.out.print("October\n");
   break;
  case 11:
   System.out.print("November\n");
   break;
  case 12:
   System.out.print("December\n");
   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

No comments:

Post a Comment