#16 - Sum 1 to N
+300 pointsContributed by: Mehdi Maujood
Implement the method sumToN
that calculates and returns the sum of all numbers (inclusive) from 1 to n
. Assume that n
will be non-zero positive integer.
sumToN(5) = 15
sumToN(2) = 3
Discuss this problem on the ApexSandbox.io Trailblazer Community Group
Loading...
offline