$$ n(n-1)/2 $$
$$ n(n+1)/2 $$
Use when calculating the sum of numbers from 0 to n−1.
Example: Sum = 0+1+2+3+4 = 10
Use when calculating the sum of numbers from 1 to n.
Example: Sum = 1+2+3+4+5 = 15