본문 바로가기
Beakjoon&프로그래머스/Java

[백준/Java] 2577번 숫자의 개수

by 현장 2022. 4. 18.

-Code

import java.util.Scanner;

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 = sc.nextInt();
        int[] nums = new int[10];
        String mul = Integer.toString(a * b * c);

        for (int i = 0; i < mul.length(); i++){
            int n = mul.charAt(i) - '0';
            nums[n] += 1;
        }

        for (int i: nums){
            System.out.println(i);
        }
    }
}