14 Decembre

This commit is contained in:
Adrian POURCHOT 2022-12-14 15:31:36 +01:00
parent 640d6da98b
commit 8699cdede4
3 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#include <stdio.h>
#include <stdlib.h>
int fibonacciRec(int n){
if(n==0){
return 0;
} if (n==1){
return 1;
} return (fibonacciRec(n-1)+fibonacciRec(n-2));
}
void afficheFiboRec(int m){
if(m==1){
printf("Le 1er terme de la suite de fibonacci est: 0\n");
}else{
afficheFiboRec(m-1);
printf("Le %dieme terme de la suite de fibonacci est: %d\n",m,fibonacciRec(m-1));
}
}
int main(){
afficheFiboRec(15);
return 0;
}

View File

@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
void exemple(unsigned n) {
if (n != 0) {
putchar('>');
exemple(n-1);
putchar('<');
} else
putchar('O');
}
int main(){
unsigned n=13;
exemple(n);
return 0;
}

View File

@ -0,0 +1,20 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
void afficheTabRec(double tab[],int taille){
if(taille==0){
} afficheTabRec(tab, taille-1);
printf("%f, ",tab[taille-1]);
}
int main(){
int i;
double tab[15]=malloc(sizeof(double));
srand(time(NULL));
for (i=0;i<15;i++){
tab[i]=(rand()%1000);
}
afficheTabRec(tab, sizeof(tab));
return 0;
}