id/email
password
forgot password
about | help | done | prefs | create account
CodingBat code practice

pyramidal

The triangular numbers are 1,3,6,10,15,21,... where the nth number is n more than the preceding number. Given a positive integer n, compute the sum of the first n triangular numbers. (These are called pyramidal numbers.)

pyramidal(2) → 4
pyramidal(3) → 10
pyramidal(4) → 20

...Save, Compile, Run         

See also Java Example Code. Java help docs: If Boolean Logic | Strings | While and For Loops | Arrays and Loops

Forget It! -- delete my code for this problem 220

Copyright Nick Parlante 2006-10 - privacy