티스토리 뷰

반응형
더보기

백준 / Java / 10998번 / A x B

 

 

import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n1 = sc.nextInt();
        int n2 = sc.nextInt();
        
        System.out.print(n1*n2);
    }
}

 

유사 문제

2022.10.26 - [Java/백준 알고리즘(JAVA)] - 백준 / Java / 1000번 / A+B / Scanner

 

백준 / Java / 1000번 / A+B / Scanner

import java.util.*; // :: 보통 utill.* (utill 패키지의 전체 클래스 선언 = all) public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(..

earth-sunny.tistory.com

 

2022.10.26 - [Java/백준 알고리즘(JAVA)] - 백준 / Java / 1001번 / A-B / Scanner

 

백준 / Java / 1001번 / A-B / Scanner

백준 / JAVA / 1001번 / A-B import java.util.*; public class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n1 = sc.nextInt(); int n2 = sc.nextInt(); System.o..

earth-sunny.tistory.com

 

백준에서는 런타임 에러로 떠서 사용 할 수 없지만 BufferdeReader로 할 경우이다.

 

import java.io.*;
import java.util.*;


public class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));	
		
		int n1 = Integer.parseInt(st.nextToken());
		int n2 = Integer.parseInt(st.nextToken());		
		
		bw.write(String.valueOf(n1*n2));
		bw.flush();
		bw.close();
			
    }

}
댓글
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
TAG more
«   2024/10   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
글 보관함