Exercices - WOA - Intro JS
Open Source Your Knowledge, Become a Contributor
Technology knowledge has to be shared and made accessible for free. Join the movement.
Un peu de calculs
Considérons la fonction f(n) définit de la manière suivante :
f(0) = 2
f(1) = 3
f(n) = 2f(n-1) + f(n-2) si n est pair et n >= 2
f(n) = f(n-1) - f(n-2) si n est impair et n >= 2
Ecrire la fonction permettant de calculer la valeur de f pour n fourni en paramètre.
Écrire l'algorithme.
1
2
3
4
5
6
7
8
9
10
function calcul_1(a) {
return a;
}
// {
module.exports = {
calcul_1: calcul_1
};
// }
Press desired key combination and then press ENTER.
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content