Last change
on this file since 81 was
81,
checked in by rosiere, 16 years ago
|
- Finish Environment (and test)
- Continue predictor_unit
- Add external tools
- svn keyword "Id" set
|
-
Property svn:keywords set to
Id
|
File size:
416 bytes
|
Rev | Line | |
---|
[2] | 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.