vgsfjij
This commit is contained in:
0
DEV1.1S/TPREC/exo2.c
Normal file
0
DEV1.1S/TPREC/exo2.c
Normal file
13
DEV1.1S/TPREC/fibonacci.c
Normal file
13
DEV1.1S/TPREC/fibonacci.c
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int fib(int n) {
|
||||
if (n > 1) return n + fib(n-1);
|
||||
else if (n == 1) return 1;
|
||||
else return 0;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
fib(15);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
17
DEV1.1S/TPREC/tableau.c
Normal file
17
DEV1.1S/TPREC/tableau.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
void printTable(double* t, int n) {
|
||||
if (n > 0) {
|
||||
printf("%.5lf", *t);
|
||||
if (n > 1) printf(", ");
|
||||
printTable(t+1, n-1);
|
||||
} else puts("");
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
double t[5] = {1.72, 5.28, 9.025, 36.14, 3.14159};
|
||||
|
||||
printTable(t, 5);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user