BUT2/DEV/DEV1.1_suite/TP_Recursivite_(suite)/Q1_Curiosite.c

25 lines
401 B
C
Raw Permalink Normal View History

2023-10-23 13:23:36 +02:00
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int f(int n) {
if (n>100)
return n-10;
else
return f(f(n+11));
}
int main (int argc, char** argv){
int nb, i;
if (argc>=2){
for (i=1; i<argc; i++){
nb = (int) strtod(argv[i],NULL);
printf("%d --> %d\n",nb, f(nb));
}
}
else{
printf("je veux plus de nombre en arguments !!!\n");
}
return 0;
}