본문 바로가기

알고리즘/백준

[백준 / 입출력] 1000 : A+B (Java)

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를 기준으로 문자열 구분

 

 

 

반응형