본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬] 4564번 숫자 카드놀이

by 현장 2023. 5. 7.

-Code

while 1:
    num = int(input())
    if num == 0:
        break
    res = [num]
    while 1:
        n = 1
        if len(str(num)) == 1:
            break
        for i in str(num):
            n *= int(i)

        res.append(n)
        num = n
    print(*res)