import java.io.*;
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());
String b = br.readLine();
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
bw.write(String.valueOf(a * (b.charAt(2) -'0')));
bw.newLine();
bw.write(String.valueOf(a * (b.charAt(1) -'0')));
bw.newLine();
bw.write(String.valueOf(a * (b.charAt(0) -'0')));
bw.newLine();
bw.write(String.valueOf(a*Integer.parseInt(b)));
bw.flush();
bw.close();
}
}
OR
import java.io.*;
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());
String B = br.readLine();
char[] b = B.toCharArray();
System.out.println(a * (b[2]-'0'));
System.out.println(a * (b[1]-'0'));
System.out.println(a * (b[0]-'0'));
System.out.println(a * Integer.parseInt(B));
}
}
OR
import java.io.*;
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%10));
System.out.println(a * (b%100/10));
System.out.println(a * (b/100));
System.out.println(a * b);
}
}
-'0'하는 이유?
: 반환값이 아스키코드인데, 우리가 원하는 것은 아스키코드가 아닌 우리가 보는 숫자 그대로 보기 위해서
String을 character 배열에 담는다.