393 B
393 B
title, tags, expertise, cover, firstSeen, lastUpdated
| title | tags | expertise | cover | firstSeen | lastUpdated |
|---|---|---|---|---|---|
| Sum of numbers until n | math | beginner | blog_images/blue-flower.jpg | 2020-10-08T16:52:55+03:00 | 2020-10-22T20:24:30+03:00 |
Sums all the numbers between 1 and n.
- Use the formula
(n * (n + 1)) / 2to get the sum of all the numbers between 1 andn.
const sumN = n => (n * (n + 1)) / 2;
sumN(100); // 5050