Ad
  • Custom User Avatar

    This test passes because the sum variable has an initial value of 0.

    If we assume number is negative, it would not meet the for loop's condition i < number, so the loop would not run.

    Since the loop doesn't run, sum still has a value of 0, which is then returned as the result.