728x90
<정답>
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();
System.out.print(A+B);
}
}
* 자바 입력 : Scanner
import java.util.Scanner;
Scanner sc = new Scanner(System.in)
//자료형에 따라
int A = sc.nextInt();
double B = sc.nextDouble();
String C = sc.next(); // 공백을 기준으로 문자열 구분
String buffer = sc.nextLint(); // Enter를 기준으로 문자열 구분
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[백준 / 입출력] 10952 : A+B - 5 (Java) (0) | 2023.09.01 |
---|---|
[백준 / 입출력] 10951 : A+B - 4 (Java) (0) | 2023.09.01 |
[백준 / 입출력] 10950 : A+B -3 (Java) (0) | 2023.09.01 |
[백준 / 입출력] 2558 : A+B - 2 (Java) (0) | 2023.09.01 |
[백준 / 입출력] 2557: Hello World (Java) (0) | 2023.09.01 |