1000번: A+B
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
www.acmicpc.net
● 문제
● 접근 방법
설명할게 없는 아주 간단한 문제.
a, b 변수를 선언하여, 입력받은 수를 넣어 더해주면 끝난다.
● 문제 풀이
import java.io.IOException;
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();
//풀이
int answer = a + b;
//출력
System.out.println(answer);
}
}
'백준' 카테고리의 다른 글
[백준] 1009번 : 분산처리 [Java] (0) | 2022.08.25 |
---|---|
[백준] 1008번 : A/B [Java] (0) | 2022.08.25 |
[백준] 1003번 : 피보나치 함수 [Java] (0) | 2022.08.24 |
[백준] 1002번 : 터렛 [Java] (0) | 2022.08.24 |
[백준] 1001번 : A-B [Java] (0) | 2022.08.24 |