Subtraction

Date: February 1983
Type: Program
Platform(s): TS 1000

Appears on

Cassette to accompany the February 1983 issue of Synchro-Sette.

Source Code

   1 SLOW 
   5 LET C$=""
   6 LET R=0
  10 PRINT ,,"FIRST NUMBER?"
  15 INPUT A$
  20 LET A=LEN A$
  24 PRINT ,,A$
  26 PRINT ,,"SECOND NUMBER?"
  30 INPUT B$
  34 PRINT ,,B$
  36 PAUSE 200
  38 FAST 
  40 IF A<LEN B$ THEN LET A=LEN B$
  50 GOSUB 1000
  60 GOSUB 500
  70 FOR N=A TO 1 STEP -1
  80 IF N=A THEN LET R=R+1
 100 LET D$=STR$ (R+VAL A$(N)+VAL E$(N))
 110 IF LEN D$<>1 THEN LET R=1
 120 IF LEN D$=1 THEN LET R=0
 130 LET C$=D$(LEN D$)+C$
 140 NEXT N
 150 FOR N=1 TO A
 160 IF A$(N)="0" THEN LET A$(N)=" "
 170 IF A$(N)<>" " THEN GOTO 190
 180 NEXT N
 190 FOR N=1 TO A
 200 IF B$(N)="0" THEN LET B$(N)=" "
 210 IF B$(N)<>" " THEN GOTO 230
 220 NEXT N
 230 FOR N=1 TO A
 240 IF C$(N)="0" THEN LET C$(N)=" "
 250 IF C$(N)<>" " THEN GOTO 270
 260 NEXT N
 270 IF LEN C$<A THEN LET C$=" "+C$
 300 PRINT ,,,," ";A$
 310 PRINT " -"
 320 PRINT " ";B$
 330 PRINT " ="
 340 PRINT " ";C$
 350 INPUT A$
 360 CLS 
 370 RUN 
 500 LET E$=B$
 510 FOR N=1 TO A
 520 LET E$(N)=STR$ (9-VAL B$(N))
 530 NEXT N
 540 RETURN 
 998 SAVE "SUBTRACTIO%N"
 999 RUN 
1000 FOR I=1 TO A-LEN A$
1010 LET A$="0"+A$
1020 NEXT I
1030 FOR I=1 TO A-LEN B$
1040 LET B$="0"+B$
1050 NEXT I
1060 RETURN 

People

No people associated with this content.

Scroll to Top