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

 

frew@mclean.com > sumUp
prev  |  next  |  chance

Return the sum of all of the integers 1..n -- use the formula n(n+1)/2 -- Example: sumUp(4) = 4 + 3 + 2 + 1 = 10


sumUp(4) → 10
sumUp(1) → 1
sumUp(10) → 55

...Save, Compile, Run (ctrl-enter)

public int sumUp(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: 100

Copyright Nick Parlante 2017 - privacy