Question 1 of 10
A garden plot helper adds consecutive row numbers. What value does sumTo(5) return?
public static int sumTo(int n)
{
if (n == 0)
{
return 0;
}
return n + sumTo(n - 1);
}
- A. 5
- B. 10
- C. 15
- D. 120