home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1987 February / 1987-02.d64 / div.worksheet (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  55 lines

  1. 710 dim x(50),y(50),z(50),r(50):sp$="       ":pr=1:rem set pr=0 for 1526, 802
  2. 720 print"[147][144]division[146]":print
  3. 730 print"enter a 1[146] for up to 99/9":printtab(8)"2[146] for up to 999/9"
  4. 740 printtab(8)"3[146] for up to 9999/99:";
  5. 750 inputa:ifa<1ora>3then720
  6. 760 xl=99:zl=102:ifa=1thenxl=9:zl=12
  7. 770 ifa=2thenxl=9:zl=112
  8. 780 input"remainders (y/n)";r$:ifr$<>"n"andr$<>"y"then780
  9. 790 input"answers (y/n)";a$:ifa$<>"n"anda$<>"y"then790
  10. 800 print"generating problems...":fori=1to50
  11. 810 x(i)=int(rnd(0)*xl)+1:z(i)=int(rnd(0)*zl)
  12. 820 r(i)=0:ifr$="y"thenr(i)=int(rnd(0)*x(i))
  13. 830 y(i)=x(i)*z(i)+r(i):ify(i)>xl*(zl-1)then810
  14. 840 ifi=1then870
  15. 850 forj=1toi-1:ifx(i)=x(j)andy(i)=y(j)andr(i)=r(j)thenj=i-1:nextj:goto810
  16. 860 nextj
  17. 870 nexti
  18. 880 print"position printhead about 1/8 inch"
  19. 890 print"below paper perforation."
  20. 900 print"press any key[146] to start printing"
  21. 910 getk$:ifk$=""then910
  22. 920 open4,4
  23. 930 print#4,chr$(14)"            division problems":rem 14 is double wide
  24. 940 print#4,:print#4,chr$(14)"name[164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164][164]"
  25. 950 fori=1to3:print#4,:nexti
  26. 960 print#4,chr$(15):rem return to normal width
  27. 970 forj=0to8:lm=6
  28. 980 ifpr=0thenopen6,4,6:print#6,chr$(22):close6:rem 1526,802
  29. 990 fori=1to6:ifj=8andi=3then1010
  30. 1000 print#4,spc(lm)"[176][192][192][192][192][192][192]";:nexti
  31. 1010 print#4,chr$(8):rem graphics mode
  32. 1020 fori=1to6:ifj=8andi=3theni=6:goto1070
  33. 1030 x$=str$(x(j*6+i)):y$=str$(y(i+j*6)):x=len(x$):y=len(y$)
  34. 1040 xs=6-x:ys=5-y
  35. 1050 print#4,chr$(15);:rem return to normal mode
  36. 1060 print#4,spc(xs)x$chr$(221)y$spc(ys)" ";
  37. 1070 nexti
  38. 1080 ifpr=0thenprint#4:open6,4,6:print#6,chr$(36):close6:rem for 1526, 802
  39. 1090 ifj<>8thenfori=1topr+4:print#4,:nexti
  40. 1100 nextj
  41. 1110 ifa$<>"y"thenend
  42. 1120 fori=1to2:print#4:nexti:forj=0to8:print#4,"    ";:fori=1to6
  43. 1130 ifj=8andi=3theni=6:goto1180
  44. 1140 z$=left$(sp$,4-len(str$(z(j*6+i))))+str$(z(j*6+i))
  45. 1150 rr$=left$(sp$,4-len(str$(r(j*6+i))))+str$(r(j*6+i))
  46. 1160 print#4,z$" ";:ifr$="y"thenprint#4,"r"rr$;" ";
  47. 1170 ifr$<>"y"thenprint#4,sp$;
  48. 1180 nexti:print#4:nextj
  49. 1190 print#4:close4
  50. 1200 print"press  r [146] to do another worksheet"
  51. 1210 print"press  q [146] to quit
  52. 1220 [161] k$:[139] k$[178]"r" [167] [138]
  53. 1230 [139] k$[178]"q" [167] [128]
  54. 1240 [137]1220
  55.