Create loop-arith.js

This commit is contained in:
Isaac Shoebottom 2022-10-05 10:08:15 -03:00
parent 0697a23f50
commit 1c0b7e612d

17
labs/L08/loop-arith.js Normal file
View File

@ -0,0 +1,17 @@
function plus(a,b) {
for (let i=0; i < a; i++){
b++;
}
return b;
}
function mult(a,b) {
sum=0;
for(let i=0; i < a; i++) {
sum = plus(sum, b)
}
return sum;
}
exports.plus = plus;
exports.mult = mult;