topic: calculate the sum of n consecutive natural numbers starting from 1, and end when the sum value is just over 100, find n
Code:
var sum = 0;
var n = 0;
while(sum <= 100){
nPP;
sum +=n;
}
console.log(sum);
console.log(n);
question: how to implement this question with for loop?