page-1983-101-timex-sinclair-programming-tricks
page-1983-101-timex-sinclair-programming-tricks
page-1983-101-timex-sinclair-programming-tricks
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
110 PRINT "RANDOM NUMBERS TOTAL ";T120 PRINT "AVERAGE NUMBER IS ";ASample RunAVERAGINGRANDOM NUMBERS TOTAL 444AVERAGE NUMBER IS 4.44AVERAGINGRANDOM NUMBERS TOT AL 424AVERAGE NUMBER IS 4.2466 Random Numbers:Sorting High/LowIt's important to be able to sort a group of numbers tosee what the highest and lowest values are. This programdoes that.The random number generator is in line 30. It givesnumbers in a range of zero to 999. Line 50 determines thelowest number in the set and line 60 finds the highestnumber.Program Listing10 LET H=g15 LET L=g20 LET N=g25 FOR A=l TO 10030 LET N=INT(lOOO*RND)35 IF A=l THEN LET L=N40 IF A=l THEN LET H=N45 PRINT "SORTING"50 IF NB THEN LET H=N70 CLS82