home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Compute! Gazette 1987 February
/
1987-02.d64
/
div.worksheet
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-09-20
|
2KB
|
55 lines
710 dim x(50),y(50),z(50),r(50):sp$=" ":pr=1:rem set pr=0 for 1526, 802
720 print"[147][144]division[146]":print
730 print"enter a 1[146] for up to 99/9":printtab(8)"2[146] for up to 999/9"
740 printtab(8)"3[146] for up to 9999/99:";
750 inputa:ifa<1ora>3then720
760 xl=99:zl=102:ifa=1thenxl=9:zl=12
770 ifa=2thenxl=9:zl=112
780 input"remainders (y/n)";r$:ifr$<>"n"andr$<>"y"then780
790 input"answers (y/n)";a$:ifa$<>"n"anda$<>"y"then790
800 print"generating problems...":fori=1to50
810 x(i)=int(rnd(0)*xl)+1:z(i)=int(rnd(0)*zl)
820 r(i)=0:ifr$="y"thenr(i)=int(rnd(0)*x(i))
830 y(i)=x(i)*z(i)+r(i):ify(i)>xl*(zl-1)then810
840 ifi=1then870
850 forj=1toi-1:ifx(i)=x(j)andy(i)=y(j)andr(i)=r(j)thenj=i-1:nextj:goto810
860 nextj
870 nexti
880 print"position printhead about 1/8 inch"
890 print"below paper perforation."
900 print"press any key[146] to start printing"
910 getk$:ifk$=""then910
920 open4,4
930 print#4,chr$(14)" division problems":rem 14 is double wide
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]"
950 fori=1to3:print#4,:nexti
960 print#4,chr$(15):rem return to normal width
970 forj=0to8:lm=6
980 ifpr=0thenopen6,4,6:print#6,chr$(22):close6:rem 1526,802
990 fori=1to6:ifj=8andi=3then1010
1000 print#4,spc(lm)"[176][192][192][192][192][192][192]";:nexti
1010 print#4,chr$(8):rem graphics mode
1020 fori=1to6:ifj=8andi=3theni=6:goto1070
1030 x$=str$(x(j*6+i)):y$=str$(y(i+j*6)):x=len(x$):y=len(y$)
1040 xs=6-x:ys=5-y
1050 print#4,chr$(15);:rem return to normal mode
1060 print#4,spc(xs)x$chr$(221)y$spc(ys)" ";
1070 nexti
1080 ifpr=0thenprint#4:open6,4,6:print#6,chr$(36):close6:rem for 1526, 802
1090 ifj<>8thenfori=1topr+4:print#4,:nexti
1100 nextj
1110 ifa$<>"y"thenend
1120 fori=1to2:print#4:nexti:forj=0to8:print#4," ";:fori=1to6
1130 ifj=8andi=3theni=6:goto1180
1140 z$=left$(sp$,4-len(str$(z(j*6+i))))+str$(z(j*6+i))
1150 rr$=left$(sp$,4-len(str$(r(j*6+i))))+str$(r(j*6+i))
1160 print#4,z$" ";:ifr$="y"thenprint#4,"r"rr$;" ";
1170 ifr$<>"y"thenprint#4,sp$;
1180 nexti:print#4:nextj
1190 print#4:close4
1200 print"press r [146] to do another worksheet"
1210 print"press q [146] to quit
1220 [161] k$:[139] k$[178]"r" [167] [138]
1230 [139] k$[178]"q" [167] [128]
1240 [137]1220