Ad
  • Custom User Avatar

    Indeed, it does call triangular(0), which returns 0, which is added to the recursive summation, causing no change to the value:
    triangular(4) =
    triangular(3) + 4 =
    triangular(2) + 3 + 4 =
    triangular(1) + 2 + 3 + 4 =
    triangular(0) + 1 + 2 + 3 + 4 =
    0 + 1 + 2 + 3 + 4 =
    10