]>
Commit | Line | Data |
---|---|---|
1 | int dummy() | |
2 | { | |
3 | return 0; | |
4 | } | |
5 | ||
6 | int mul(int in1, int in2) { | |
7 | int result = 0; | |
8 | while (in2 > 0) { | |
9 | in2 = in2 - 1; | |
10 | result = result + in1; | |
11 | } | |
12 | dummy(); | |
13 | return result; | |
14 | } | |
15 | ||
16 | int fact(int num) { | |
17 | if (num == 0) | |
18 | return 1; | |
19 | return mul(num, fact(num-1)); | |
20 | } | |
21 | ||
22 | int main() { | |
23 | int i = 1; | |
24 | ||
25 | while (i < 10) | |
26 | { | |
27 | printint(i); | |
28 | printint(fact(i)); | |
29 | i = i + 1; | |
30 | } | |
31 | return i; | |
32 | } |