- #include <stdio.h>
- /*
- Fonction 91 McCarthy
-
- http://www.Software-DS.com
-
-
- Compilation :
- gcc -o McCarthy Fonction91McCarthy.c
- */
-
- int func91McCarthy(int x);
-
- int main(void) {
- int x;
-
- printf("Si vous entrez une valeur <101, vous obtiendrez 91.");
- do {
- printf("\nx= ");
- scanf("%d",&x);
- } while(x<0);
-
-
- printf("\n\nResultats: %d\n", func91McCarthy(x));
- printf("Fin\n");
- } /* main */
-
-
- int func91McCarthy(int x) {
- if (x>100)
- return (x-10);
- else
- return (func91McCarthy(func91McCarthy(x+11)));
- } /* func91McCarthy */
#include <stdio.h>
/*
Fonction 91 McCarthy
http://www.Software-DS.com
Compilation :
gcc -o McCarthy Fonction91McCarthy.c
*/
int func91McCarthy(int x);
int main(void) {
int x;
printf("Si vous entrez une valeur <101, vous obtiendrez 91.");
do {
printf("\nx= ");
scanf("%d",&x);
} while(x<0);
printf("\n\nResultats: %d\n", func91McCarthy(x));
printf("Fin\n");
} /* main */
int func91McCarthy(int x) {
if (x>100)
return (x-10);
else
return (func91McCarthy(func91McCarthy(x+11)));
} /* func91McCarthy */