알고리즘/백준
[백준 2588번 ː 자바(JAVA)] 곱셈
그릿er
2020. 4. 14. 16:55
<문제>
(세 자리 수) × (세 자리 수)는 다음과 같은 과정을 통하여 이루어진다.

(1)과 (2)위치에 들어갈 세 자리 자연수가 주어질 때 (3), (4), (5), (6)위치에 들어갈 값을 구하는 프로그램을 작성하시오.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = b%10;
System.out.println(a*c);
System.out.println(a*((b-c)%100)/10);
System.out.println(a*(b/100));
System.out.println(a*b);
}
}
|