12.07.2015 Views

page-1983-101-timex-sinclair-programming-tricks

page-1983-101-timex-sinclair-programming-tricks

page-1983-101-timex-sinclair-programming-tricks

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

100 LET D=l-0.0l*P110 LET R=W/D120 PRINT •RETAIL PRICE = $•;R130 PRINT140 GOTO 1073 Percentage OffFrom earlier tips in this book, you know how to makeyour TIMEX convert percentages to decimals. But what ifyou want to know "percentage off?"For example, how much is 40 percent off? This programcan be used to interpret 40 percent off and computethe decimal value needed. Try 40 percent off $100. Thecomputer will change 40 percent off into decimal value0.60. If you multiply 0.60 times $100 you find $60 is 40 percentoff $100.Line 30 makes the important translation.Program Listing10 PRINT •PERCENTAGE OFF:n ,•20 INPUT p30 PRINT p40 PRINT •nECIMAL: •;(1-0.0l*P)50 PRINT60 GOTO 1074 Dollars & CentsIf the result of your computation is a "money"answer, and you don't know whether to display it indollars or cents, let the computer decide.This program decides whether to display the outputin dollars or cents. Line 90 in the program makes thedecision.93

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!