id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
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 (ctrl-enter)

public int pyramidal(int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 220

Copyright Nick Parlante 2017 - privacy