-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4564.cpp
More file actions
50 lines (47 loc) · 726 Bytes
/
4564.cpp
File metadata and controls
50 lines (47 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// 4564. 숫자 카드놀이
// 2021.04.11
// 구현
#include<iostream>
using namespace std;
int func(int k)
{
int ans = 1;
while (k > 0)
{
ans *= k % 10;
k /= 10;
}
return ans;
}
int main()
{
int k;
int tmp;
while (1)
{
cin >> k;
if (k == 0)
{
break;
}
cout << k;
if (k < 10)
{
cout << endl;
continue;
}
cout << " ";
while (1)
{
tmp = func(k);
cout << tmp << " ";
k = tmp;
if (k < 10)
{
cout << endl;
break;
}
}
}
return 0;
}