풀이
세 자리 자연수의 각 자릿값을 구할 수 있으면 쉽게 해결할 수 있다.
자릿값을 구할 땐 10으로 나누어 나머지를 구하면 된다.
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner scan=new Scanner(System.in);
int a=scan.nextInt();
int b=scan.nextInt();
System.out.println(a*(b%10));
System.out.println(a*((b/10)%10));
System.out.println(a*(b/100));
System.out.println(a*b);
}
}
'알고리즘' 카테고리의 다른 글
[백준 알고리즘] 1975번 소수찾기. 파이썬(python) (0) | 2022.04.20 |
---|---|
[백준 알고리즘] 2075번 N번째 큰 수. 파이썬(python) (0) | 2022.04.15 |
[백준 알고리즘] 2439번 별 찍기-2. 자바(java) (0) | 2020.02.17 |
[백준 알고리즘] 2438번 별 찍기-1. 자바(java) (0) | 2020.02.17 |
[백준 알고리즘] 2884번 알람 시계. 자바(java) (0) | 2020.02.17 |