Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sum = 0
- var num
- num = prompt("Enter new value, or 0 to end")
- while (num != 0) {
- sum = sum + parseInt(num)
- num = prompt("Enter new value, or 0 to end")
- }
- alert("Sum = " + sum)
- **** UPDATE ****
- var sum = 0
- var num = prompt("Enter new value, or 0 to end")
- while (num != 0) {
- sum = sum + parseInt(num)
- num = prompt("Enter new value, or 0 to end")
- }
- alert("Sum = " + sum)
Add Comment
Please, Sign In to add comment