source:
trunk/Softwares/Basic_test.or32/src/c/func_factoriel.c
@
27
Last change on this file since 27 was 2, checked in by , 18 years ago | |
---|---|
File size: 416 bytes |
Line | |
---|---|
1 | #include "func_factoriel.h" |
2 | #include "func_math.h" |
3 | |
4 | //-----[ Factoriel ]------------------------------------------------------- |
5 | |
6 | unsigned int fact_recursif (unsigned int x) |
7 | { |
8 | if ( x <= 1) |
9 | return 1; |
10 | |
11 | return (mul_soft (x , fact_recursif (x-1) ) ); |
12 | } |
13 | |
14 | unsigned int fact_iteratif (unsigned int x) |
15 | { |
16 | unsigned int res= 1; |
17 | |
18 | while (x > 1) |
19 | { |
20 | res = mul_soft(res,x); |
21 | x --; |
22 | } |
23 | return res; |
24 | } |
Note: See TracBrowser
for help on using the repository browser.