Start learning free

LESSON 24 OF 349 · CALCULATIONS WITH NUMBERS

Exercise: Free Coffee Cups in Swift

Lesson

For each of the 6 coffee cups I buy, I get a 7th cup free. In total, I get 7 cups.

Knowing that I paid for cups cups, compute and print the total number of cups I would get (number of cups I paid for + number of cups I got for free).


Example:

For example, if cups was 12, the answer would be 14.

Why? Because I paid for 12 cups and I got 2 for free, which is a total of 14 cups.

STEP 1 OF 1
    Ctrl + Enter to check

    Free Coffee Cups in Swift

    Keep going with SwiftAbout 340 step-by-step lessons, from your first line of code to coding interviews. Free to start.
    Start learning free