Ignore:
Timestamp:
Apr 20, 2009, 11:29:17 PM (15 years ago)
Author:
rosiere
Message:

1) Write queue with mealy
2) Network : fix bug
3) leak memory

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Softwares/Test/Test_099/src/c/main.c

    r102 r115  
    1313#include "func_io.h"
    1414
     15#define mul(x,y) x*y
     16
     17unsigned int f1 (unsigned int x)
     18{
     19  if ( x <= 1)
     20    return 1;
     21
     22  unsigned int res = mul (x , f1 (x-1));
     23 
     24  return res;
     25}
     26
     27unsigned int f2 (unsigned int x)
     28{
     29  unsigned int res= 1;
     30 
     31  while (x > 1)
     32    {
     33      res = mul(res,x);
     34      x --;
     35    }
     36  return res;
     37}
     38
    1539int main()
    1640{
    17   test_mul_soft           ();
    18   test_div_soft           ();
    19   test_modulo             ();
    20   test_fibonnacci         (30);
    21   test_n_premier          (6);
    22   test_factoriel_iteratif (12);
    23   test_factoriel_recursif (12);
    24    
     41  for (int i=0; i<500; ++i)
     42    if (f2 (12) != 479001600) quit(i);
    2543  quit(0);
    2644}
Note: See TracChangeset for help on using the changeset viewer.