APL/Révisions/CM/debordement.c

20 lines
447 B
C
Raw Permalink Normal View History

2022-01-25 12:00:33 +01:00
#include <stdio.h>
#include <stdlib.h>
unsigned long int factorielle(unsigned long int n) {
if (n > 1) {
return n * factorielle(n-1);
} else return 1UL;
}
int main(int argc, char *argv[]) {
unsigned long int l;
int n = 1;
printf("%d\n", sizeof(l));
while (factorielle(n+1) >= factorielle(n)) n++;
l = factorielle(n);
printf("valeur de n = %d, valeur de %d! = %lu\n", n, n, l);
return EXIT_SUCCESS;
}