debut pile

This commit is contained in:
2024-01-08 14:05:33 +01:00
parent c4bc163fe6
commit cffb424f64
29 changed files with 442 additions and 7 deletions

BIN
DEV1.1/TP26/fibonacci Executable file

Binary file not shown.

15
DEV1.1/TP26/fibonacci.c Normal file
View File

@@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
int fibonacci(int n, int val, int valeur){
int nombre;
if (n==0){
printf("%d\n",val);
}
fibonacci(n-1, valeur, val+valeur);
}
int main(){
fibonacci(9,0,1);
return EXIT_SUCCESS;
}

BIN
DEV1.1/TP26/fibonacci2 Executable file

Binary file not shown.

15
DEV1.1/TP26/fibonacci2.c Normal file
View File

@@ -0,0 +1,15 @@
#include <stdio.h>
#include <stdlib.h>
int fibonacci(int n, int val, int valeur){
int nombre;
if (n){
printf("%d\n",val);
fibonacci(n-1, valeur, val+valeur);
}
}
int main(){
fibonacci(15,0,1);
return EXIT_SUCCESS;
}

BIN
DEV1.1/TP26/phase Executable file

Binary file not shown.

18
DEV1.1/TP26/phase.c Normal file
View File

@@ -0,0 +1,18 @@
#include <stdio.h>
#include <stdlib.h>
void exemple(unsigned n) {
if (n != 0) {
putchar('>');
exemple(n-1);
putchar('<');
} else
putchar('O');
}
int main(){
exemple(5);
return EXIT_SUCCESS;
}
/*phase ascendente prmier puchar puis troisième putchar et phase
descendante au deuxième putchar*/

BIN
DEV1.1/TP26/tableau Executable file

Binary file not shown.

17
DEV1.1/TP26/tableau.c Normal file
View File

@@ -0,0 +1,17 @@
#include <stdio.h>
#include <stdlib.h>
void afficher(double tab[], int taille){
if (taille>1){
printf("%f, ",tab[0]);
afficher(tab+1, taille-1);
}else{
printf("%f\n",tab[0]);
}
}
int main(){
double tab[5]={1.25, 47.80, 77.01, 54.23, 895.14};
afficher(tab, 5);
return EXIT_SUCCESS;
}