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.

Sample Run51 YES 4649 NO 54YESNO42 YES 5258 NO 48YESNO56 YES 4844 NO 52YESNO63 Random Numbers:Zero To NineAlthough you see four program lines below, wnat wereally have here is a very convenient single-line programfor you to insert in a larger game or educational-testingprogram.Line 20 is the winner here. It prints a random numberfrom zero to nine every time. For your use here, we printthat number on the screen. You could just as easily havethe computer store that random number in a memorylocation for later recall and use.We have added lines 10, 30 and 40 to make yourTIMEX show you a whole series of random numbers fromzero to nine. Remember, line 20 is the important singlelineprogram element here.If you would like random numbers in the range fromzero to 99, make it 100* in line 20. For zero to 999, use1000* in line 20.Program Listing10 RAND20 PRINT INT (lO*RND)30 PAUSE 10040 GOTO 2079

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

Saved successfully!

Ooh no, something went wrong!