List of all available Websheets
Viewing cpp/cs103/hw-recursion/sum_range by dpritcha@usc.edu. You have unsaved changes. Log in above to create, edit, preview and publish Websheets.
Property | Value |
---|---|
Description html markup shown to student | Define a recursive function <tt>int sum_range(int low, int high)</tt> that computes the sum $$\textrm{low} + (\textrm{low}+1) + (\textrm{low}+2) + \dotsb + \textrm{high}$$ using recursion. You can assume $\textrm{low} \le \textrm{high}$. <br> E.g. <tt>sum_up_to(10, 12)</tt> is 10+11+12 which is 33. |
Engine | |
Template / Reference solution | int sum_range(int low, int high) { \[ REDACTED ]\ } |
C++ test suite See manual | [ ["check-function", "sum_range", "int", ["int", "int"]], ["call-function", "sum_range", ["10", "12"]], ["call-function", "sum_range", ["1", "5"]], ["call-function", "sum_range", ["0", "10"]], ["call-function", "sum_range", ["-20", "20"]] ] |
Forbidden substrings json list of strings e.g. ["for","while"] | ["#include", "for", "while", "*"] |
Note: problems are open-source by default (see 'Public permissions'). Assumed license for open problems is Creative Commons 4.0 Attribution-ShareAlike unless specified in 'Remarks'.