basics · beginner · ~15 min
Reuse the loop pattern for a product.
Implement long product_range(int lo, int hi) returning the product of integers lo..hi inclusive. If lo > hi, return 1 (the empty product).
long product_range(int lo, int hi) {
/* TODO */
return 1;
}
Solve this exercise in the browser editor — compile and run against the test harness, no setup required.