-
10951 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.PS/백준 2022. 2. 16. 20:31
종료 방식은 Ctrl + D 나 Ctrl + X로 종료하세요
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader buf = new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb = new StringBuilder(); String str = ""; while((str = buf.readLine()) != null) { String[] arr = str.split(" "); sb.append(Integer.parseInt(arr[0]) + Integer.parseInt(arr[1])); sb.append("\n"); } System.out.println(sb); } }
'PS > 백준' 카테고리의 다른 글
10953 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. (0) 2022.02.18 10952 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. (0) 2022.02.17 10950 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. (0) 2022.02.15 2558 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.(줄 바꿔서 입력) (0) 2022.02.14 1000 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.(한줄로 입력) (0) 2022.02.14