Create loop-arith.js
This commit is contained in:
parent
0697a23f50
commit
1c0b7e612d
17
labs/L08/loop-arith.js
Normal file
17
labs/L08/loop-arith.js
Normal 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;
|
Loading…
Reference in New Issue
Block a user