DEV Community

Discussion on: Addition of n successive integers.

Collapse
 
sharif1014 profile image
Md. Shariful Islam

I have seen your comment but I don't want to understand that actually I wanted the JavaScript code where the use give the value of n through the browser using an input box.

Collapse
 
saileshbro profile image
Sailesh Dahal
function getSumUpto(n){
    return (n+1)*n*0.5;
}
Enter fullscreen mode Exit fullscreen mode