Enter wholesale price ? 100 Retail price: 150 Enter wholesale price ? 200 Retail price: 300 Enter wholesale price ? 50 Retail price: 75 Enter wholesale price ?
Since the program repeats the loop body again and again it does not stop after the third item but asks for another. Remember, if you want to stop it at this point, hit CONTROL-BREAK.
Here is our program:
' Retail price calculator ' with 50% markup DO PRINT "Enter wholesale price" ' ask the user for the wholesale price INPUT WHOLESALE ' get the price, put it in a variable PRINT "Retail price:", WHOLESALE * 1.5 ' compute and print out the retail price LOOP END
The DO
and the
LOOP
bracket the loop body.
To clearly indicate which statements are in the loop body,
indent each statement between DO
and
LOOP
.
This is as important to programming as grouping sentences into paragraphs
is important to writing good English.
Are prices in a store always marked up by 50 percent?