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

 

tmhscs@gmail.com fundamentals > fund_sum1toN
prev  |  next  |  chance

Given an integer, return the sum of all numbers from 1 up to and including that number. For example, if the given number is 7, you should return 1+2+3+4+5+6+7.


fund_sum1toN(1) → 1
fund_sum1toN(2) → 3
fund_sum1toN(3) → 6

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

public int fund_sum1toN(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

Post-solution available

Copyright Nick Parlante 2017 - privacy