shishantpandeyAug 22, 20221 min readHOW TO FIND FUM OF FIRST N NATURAL NUMBER IN JAVASCRIPT let sum = 0; let lastnum = prompt("enter the number"); a = Number.parseInt(a); for (let i = 0; i <= lastnum; i++) { sum = i + sum; } document.write("sum of all the numbers is", sum);MY OTHER PROGRAMSMY PROJECT
let sum = 0; let lastnum = prompt("enter the number"); a = Number.parseInt(a); for (let i = 0; i <= lastnum; i++) { sum = i + sum; } document.write("sum of all the numbers is", sum);MY OTHER PROGRAMSMY PROJECT
Comments