Challenges

Sum Numbers with For Loop

Complete the method sumToN that accepts an Integer parameter n. Use a for loop to calculate and return the sum of all integers from 1 to n (inclusive). For example, if n is 5, return 1+2+3+4+5 = 15.

Editor
Test Results

Result Panel

Hit the run button to test your code!