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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Lines 40 to 70 select the highest and lowest numbersin the range. They actually define the range. Then line 90finds the middle point of that range.Program Listing10 LET N=frf15 LET M=frf20 LET H=frf25 LET L=frf30 PRINT nGIVE .ME A NUMBER n;35 INPUT Z40 IF Z=frf THN GOTO 9045 PRINT Z50 LET N=N+l55 IF N=l THEN LET H=Z60 IF N=l THEN LET L=Z65 IF ZH THEN LET H=Z80 GOTO 3090 LET M=L+((H-L)/2)100 CLS110 PRINT nTHE MID-RANGE NUMBER IS n;M120 PRINT130 GOTO 1058 Rounding OffThe technique for rounding off numbers is easy.This program, which can stand alone or be worked into alarger program as a subroutine, rounds a decimal to thenearest whole number.Program Listing10 LET R=frf15 LET D=frf20 PRINT nGIVE .ME A NUMBERn25 PRINT nTO BE ROUNDED OFF"·75

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

Saved successfully!

Ooh no, something went wrong!