CS2613/labs/L08/loop-arith.js

17 lines
232 B
JavaScript
Raw Normal View History

2022-10-05 10:08:15 -03:00
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;