How to properly calculate dependent nested loops for big-O
We can write the for loop as the sums;

$$\sum_{i=1}^{n} \sum_{j = 1}^{i} 1 = \sum_{i=1}^{n}i = \frac{n(n+1)}{2} \in\mathcal{O}(n^2) \, .$$

Note: set the starting values from $i = 1$ and $j = 1$, and increment the upper boundaries also. The calculation in the inner function is assumed as a constant operation and it will not change the calculation.