[백준/ 10950번] A+B - 3 (Java)
2023. 12. 16. 11:39ㆍ[ CodingTest ]/Baekjoon
문제
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 테스트 케이스의 개수 T가 주어진다.
각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)
출력
각 테스트 케이스마다 A+B를 출력한다.

풀이(소스 코드)
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int count = sc.nextInt();
int first [] = null;
first = new int[count];
int second [] = null;
second = new int[count];
for (int i = 0; i < count; i++) {
first[i] = sc.nextInt();
second[i] = sc.nextInt();
}
for (int i = 0; i < count; i++) {
int sum = first[i] + second[i];
System.out.println(sum);
}
}
}
728x90
'[ CodingTest ] > Baekjoon' 카테고리의 다른 글
[백준/ 25304번] 영수증 (Java) (0) | 2023.12.16 |
---|---|
[백준/ 8393번] 합 (Java) (0) | 2023.12.16 |
[백준/ 2739번] 구구단 (Java) (0) | 2023.12.16 |
[백준/ 2525번] 오븐 시계 (Java) (0) | 2023.12.15 |
[백준/ 2884번] 알람 시계 (Java) (0) | 2023.12.15 |