On each birthday cake there is one candle per year of age. Write total_candles(age) to work out how many candles were used from age 1 to age. An age of 0 is 0 candles.
total_candles(3)→6total_candles(1)→1int total_candles(int age)int total_candles(int age) {
int total = 0;
for (int year = 1; year <= age; year++) {
// your code here: add this year's candles to total
}
return total;
}
Run tries the examples. When they look right, Submit.