my code to find triangular number-written in 3 minutes