Changeset 108 for trunk/Softwares/Common
- Timestamp:
- Feb 12, 2009, 12:55:06 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Softwares/Common/src/c/func_factoriel.c
r102 r108 9 9 if ( x <= 1) 10 10 return 1; 11 12 unsigned int res = mul_soft (x , factoriel_recursif (x-1)); 11 13 12 return (mul_soft (x , factoriel_recursif (x-1) ) );14 return res; 13 15 } 14 16 … … 31 33 void test_factoriel_iteratif (int x) 32 34 { 35 int x_min = 0; 33 36 int x_max = 12; 34 37 int wait [x_max+1]; … … 48 51 wait[12] = 479001600; // 1c8cfc00 49 52 50 for (int i = 0; i <= ((x<x_max)?x:x_max); i ++)53 for (int i = x_min; i <= ((x<x_max)?x:x_max); i ++) 51 54 if (factoriel_iteratif (i) != wait[i]) quit(i+1); 52 55 } … … 54 57 void test_factoriel_recursif (int x) 55 58 { 59 int x_min = 0; 56 60 int x_max = 12; 57 61 int wait [x_max+1]; … … 71 75 wait[12] = 479001600; // 1c8cfc00 72 76 73 for (int i = 0; i <= ((x<x_max)?x:x_max); i ++)77 for (int i = x_min; i <= ((x<x_max)?x:x_max); i ++) 74 78 if (factoriel_recursif (i) != wait[i]) quit(i+1); 75 79 }
Note: See TracChangeset
for help on using the changeset viewer.