basics · beginner · ~15 min
Write a small unit a build would compile and link.
Implement long sum_range(int lo, int hi) returning the sum of all integers from lo to hi inclusive. If lo > hi, return 0.
long sum_range(int lo, int hi) {
/* TODO */
return 0;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.