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 4.0
The number of scoops is 4 and it costs 2 dollars per scoop. Since vanilla is the flavor and vanilla is half off, the total cost of this order is .5(4 * 2) = 4.0
Run the code to verify.