반응형
1.Scanner를 이용한 방법
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.println(A*B);
sc.close();
}
}
2. BufferedReader를 이용한 방법
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int A = Integer.parseInt(br.readLine());
int B = Integer.parseInt(br.readLine());
System.out.println(A*B);
br.close();
}
}
간단하게 A X B를 하면 되는 문제다.
반응형
'알고리즘 > 백준' 카테고리의 다른 글
[백준] 3009 - 네번째 점 (JAVA/ 자바) (0) | 2024.04.12 |
---|---|
[백준] 1085 - 직사각형에서 탈출 (JAVA/ 자바) (0) | 2024.04.11 |
[백준] 11653 - 소인수분해 (JAVA/ 자바) (0) | 2024.04.09 |
[백준] 2581 - 소수 (JAVA/ 자바) (0) | 2024.04.08 |
[백준] 1978 - 소수 찾기 (JAVA/ 자바) (0) | 2024.04.06 |