2021.09.15 작성
이 전 게시글과 마찬가지로 입력받고 곱하면 되는 간단한 사칙연산 문제이다.
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);
}
}
기본적으로 정수형 a, b 변수에 입력받아 두 수를 곱한 값을 출력
import java.io.*;
import java.util.StringTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
/* 빠른 입출력 */
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
StringTokenizer st = new StringTokenizer(bf.readLine());
int a = Integer.parseInt(st.nextToken());
int b = Integer.parseInt(st.nextToken());
bw.write(String.valueOf(a * b));
bw.flush();
bw.close();
}
}
마찬가지로 한 줄에 두 수를 입력받아야 하니 StringTokenizer로 입력받아 공백으로 나누고 출력하면 된다.
제출 번호 33337032번 - 일반 입력
제출 번호 33337060번 - 빠른 입력