본문 바로가기
Algorithm/Programmers

[Programmers] Lv.0 / a와 b 출력하기 / Java

by unknownomad 2023. 10. 17.

문제

 

풀이

import java.util.Scanner;

public class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println("a = " + a);
        System.out.println("b = " + b);
        sc.close();
    }
}
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

public class Solution {
    public static void main(String[] args) throws Exception {

        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

        String[] params = br.readLine().split(" ");
        bw.write("a = " + params[0] + "\n");
        bw.write("b = " + params[1]);

        bw.flush();
        bw.close();
        br.close();
    }
}

 

출처

https://school.programmers.co.kr/learn/courses/30/lessons/181951

댓글