반응형
#!
import java.util.*;
public class Main {
public static void main(String[] args) {
int A = 0;
int B = 0;
Scanner scan = new Scanner(System.in); //입력함수 호출 위해 scanner 클래스 선언
A = scan.nextInt();
B = scan.nextInt();
System.out.print(A+B);
}
}
#2
*한번에 선언과 입력 동시에 하기
import java.util.Scanner;
class Main{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
int A = input.nextInt();
int B = input.nextInt();
System.out.println(A+B);
}
}
반응형
'백준_Java' 카테고리의 다른 글
#2501_k번째 인수_bufferedReader (0) | 2021.09.11 |
---|---|
2588_형변환/자릿수로 쪼개기 (0) | 2021.08.17 |
10171_역슬래쉬 출력 (0) | 2021.08.17 |
10718_for문 출력 (0) | 2021.08.17 |
2557_hello world 출력 (0) | 2021.08.17 |