Kebab file names

This commit is contained in:
Angelos Chalaris
2023-04-27 21:58:35 +03:00
parent 1d189c709a
commit 61200d90c4
440 changed files with 0 additions and 0 deletions

19
snippets/sum-n.md Normal file
View File

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