top of page
shishantpandey

HOW 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);






8 views0 comments

Recent Posts

See All

Comments


Post: Blog2_Post
bottom of page