What will the program output when you run
1 2 |
|
using the below code?
Try to walk through the program in your head to find the answer before you actually run the code.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
|
This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try
refreshing the page, (b) enabling javascript if it is disabled on your browser and,
finally, (c)
loading the
non-javascript version of this page
. We're sorry about the hassle.
The answer is 2.
The number of scoops available at the beginning is 6. Then the customer orders 4 scoops. 6 - 4 = 2 scoops remaining.
Run the code to verify.