source: trunk/Softwares/Basic_test.or32/src/c/func_factoriel.c @ 2

Last change on this file since 2 was 2, checked in by kane, 17 years ago

Import Morpheo

File size: 416 bytes
Line 
1#include "func_factoriel.h"
2#include "func_math.h"
3
4//-----[ Factoriel ]-------------------------------------------------------
5
6unsigned 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
14unsigned 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.