I Need to sum the number that come from prompt and stop if the user enter 0 and the sum variable not >100 and if the user enter a string

var sum = 0;

do {

var prom = parseInt(prompt(‘Enter A Number’));

if (isFinite(prom)) {

sum += prom;

alert('the Sum Is :' + sum);

} else {

alert('Please Enter A Number');

}

} while (prom || sum < 100);

if the user enter a string alert him and continue the loop

Check the condition on the while, as it is right now it evaluates to always true.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.