...

Exercise: Savings Goal

In this exercise, some of the code inside the loop is already written for you. Notice the two new shorthands:

  • balance += savings is a shorthand for balance = balance + savings
  • month++ is a shorthand for month = month + 1

These shorthands are used commonly when writing loops, and make your code shorter and easier to read.

Similar shorthands exist for other arithmetic operations, such as --, -=, *=, and /=.

Your Task

Complete the code sample, a program that calculates how much you will save in a year. You just need to write the while condition so the loop runs exactly 12 times.

Variables

No variables

Loading...

Output (Console)