You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
620 B
24 lines
620 B
3 years ago
|
<html><body><pre><script>
|
||
|
|
||
|
document.write("\nmultiplier en recursif 3 * 5 \n");
|
||
|
/* Pseuso code :
|
||
3 years ago
|
fonction mutiplier(opg, opd)
|
||
|
si opd == 1 alors
|
||
|
retourner opg;
|
||
|
sinon
|
||
|
retourner (multiplier(opg, opd-1) + opg)
|
||
|
fin si
|
||
|
fin fonction
|
||
3 years ago
|
*/
|
||
|
function multiplier(opg, opd) {
|
||
|
console.log('mulitplier '+opg+'*'+opd);
|
||
|
if(opd == 1) {
|
||
|
return opg;
|
||
|
}
|
||
|
else {
|
||
|
return (multiplier(opg, opd -1) + opg);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
document.write(multiplier(3,5));
|
||
|
</script></pre></body></html>
|