CodeUp/Java

[CodeUp] 1065-1070 (Java)

chaereemee 2022. 11. 3. 23:23

# 1065 : 정수 3개 입력 받아 짝수만 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a%2==0) {
            System.out.println(a);
        }
        if (b%2==0) {
            System.out.println(b);
        }
        if (c%2==0) {
            System.out.println(c);
        }
        sc.close();
    }
}

 

# 1066 : 정수 3개 입력 받아 짝/홀 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        if (a%2==0) {
            System.out.println("even");
        }
        else {
            System.out.println("odd");
        }
       if (b%2==0) {
            System.out.println("even");
        }
        else {
            System.out.println("odd");
        }
        if (c%2==0) {
            System.out.println("even");
        }
        else {
            System.out.println("odd");
        }
        sc.close();
    }
}

 

# 1067 : 정수 1개 입력 받아 분석

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int num = sc.nextInt();
        if (num<0) {
            System.out.println("minus");
        }
        else {
            System.out.println("plus");
        }
        if (num%2==0) {
            System.out.println("even");
        }
        else {
            System.out.println("odd");
        }
        sc.close();
    }
}

 

# 1068 : 정수 1개 입력 받아 평가 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int score = sc.nextInt();
        if (score >= 90) {
            System.out.println("A");
        }
        else if (score >= 70) {
            System.out.println("B");
        }
        else if (score >= 40) {
            System.out.println("C");
        }
        else {
            System.out.println("D");
        }
        sc.close();
    }
}

 

# 1069 : 평가 입력 받아 다르게 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char ch = sc.next().charAt(0);
        switch(ch) {
            case 'A' :
                System.out.println("best!!!");
                break;
            case 'B' :
                System.out.println("good!!");
                break;
            case 'C' :
                System.out.println("run!");
                break;
            case 'D' :
                System.out.println("slowly~");
                break;
            default:
                System.out.println("what?");
        }
        sc.close();
    }
}

 

# 1070 : 월 입력 받아 계절 출력

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int month = sc.nextInt();
        sc.close();
        switch(month) {
            case 12: case 1: case 2:
                System.out.println("winter");
                break;
            case 3: case 4: case 5:
                System.out.println("spring");
                break;
            case 6: case 7: case 8:
                System.out.println("summer");
                break;
            case 9: case 10: case 11:
                System.out.println("fall");
                break;
        }
    }
}

 

https://codeup.kr/index.php

 

CodeUp

☆ 파이썬 다운로드 : 파이썬3 ☆ 무료 C언어 IDE : Code::blocks       DEV C++ ☆ 추천 온라인 IDE : C   C++11   Python3   Java ☆ 채점 가능 언어 : C, C++, JAVA, Python 3.5 ★ C++로 제출시 void main()을 사용하면

codeup.kr