Write a function `sum_to_n(n)` that takes an integer `n` and returns the sum of all integers from 1 to n inclusive. For example, `sum_to_n(5)` returns `1 + 2 + 3 + 4 + 5 = 15`. Assume `n` is a non-negative integer (n >= 0). If `n` is 0, return 0. Use a loop or arithmetic formula.
Constraints
0 <= n <= 1000. The function should handle integers within this range efficiently. Time complexity: O(n) or O(1).