공부하시는대에 도움이 됐으면 좋겠습니다.
답안코드 확인해주세요!
더보기
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner in = new Scanner(System.in);
int input1 = in.nextInt();
int input2 = in.nextInt();
int input3 = in.nextInt();
int get = input1 * input2 * input3;
String[] good;
String change = Integer.toString(get);
good = change.split("");
int[] result = new int[10];
for (int i = 0; i < good.length; i++) {
if (good[i].equals("0")) {
result[0]++;
} else if (good[i].equals("1")) {
result[1]++;
} else if (good[i].equals("2")) {
result[2]++;
} else if (good[i].equals("3")) {
result[3]++;
} else if (good[i].equals("4")) {
result[4]++;
} else if (good[i].equals("5")) {
result[5]++;
} else if (good[i].equals("6")) {
result[6]++;
} else if (good[i].equals("7")) {
result[7]++;
} else if (good[i].equals("8")) {
result[8]++;
} else if (good[i].equals("9")) {
result[9]++;
}
}
for (int i = 0; i < result.length; i++) {
System.out.println(result[i]);
}
}
}
더 많은 자바코드가 보고 싶다면?
댓글