Alternate
Alternate
A natural number \(n\) is given. Calculate the value of the expression:
\[1 \cdot n + 2 \cdot (n - 1) - 3 \cdot (n - 2) + 4 \cdot (n - 3) + 5 \cdot (n - 4) - 6 \cdot (n - 5) + \ldots \pm n \cdot 1\]
You can assume that \(1 \leq n \leq 1000000\).
Solve this using loops, while math enthusiasts are invited to try it without loops.