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

 

dsawyer@methacton.org intro_p4_level_3 > sumNums
prev  |  next  |  chance

Given two ints n1 and n2, return the sum of the all the integers from n1 to n2. If n1 is greater than n2, return zero.


sumNums(2, 3) → 5
sumNums(3, 6) → 18
sumNums(3, 2) → 0

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

public int sumNums( int n1, int n2 ){ }

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: 200

Copyright Nick Parlante 2017 - privacy