EasyManua.ls Logo

Commodore PET - Page 220

Commodore PET
447 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Print answer
If
A$<B$.
switch strings
Clear screen
Input
numeric strings
Subtraction loop (based
on
lines 1020-1100 of the addition
program)
} Clear strings and variables
THEt.j
L=L+1 } Truncate leading zeros
THEN
1
::::LEN
CC$) and blanks
1
(1
FR
l
tH"
:'>f.:+;:+;:;:;UI:Tf':ACT
l
OtJo+::+::+;"
:
Pi":
l
tH
,:2(1
HJPUT
A$.,
I:$
30
BLAtjf<$="
"1
4(1
:'·';=LENCA$)·
'T'=LEN(E:$) Right justify strings (from
50
IF
;'·';'CT'
THEN
A$=LEFT$ C
E:LAt·JK$
..
'/--i·':)
+A$
lines 20-60 of the addition
60
IF
'T'<>';
THEN
B$=LEFT$(E:LANK$
..
>~-'T')+E:$
program)
1::'5
IF
...
AL
CA$)
=',
...
AL
C
E:$)
THEN
C$="
(1"
:
GOTO
115(1
70
IF
VALCA$»=VALCB$)
GOTO
1000
80
X$=A$A$=B$B$=X$
90
S=l
1000
REM*:+;SUBTRACTION
ROUTINE.:+:
1010
FOR
I=LENCA$)
TO
1
STEP-l
1020
A=VALCMID$CA$,I,l»
:1.
O:~:O
A=A+D:
D=O
1040
B=VALCMID$CB$,
1,1»
105(1
IF
CA-B)<0
THEN
D=-l
A=A+I0
1
(160
C=A-E:
1070
C$=RIGHT$C8TR$CC),1)+C$
10::;:(1
t·J[;:-';T
1
1090
FOR
1=1
TO
LENCC$)
1100
IF
VALCMID$CC$,I,l»=O
1110
IF
VALCLEFT$CC$,I»<>0
1120
t·JEi·~T
1
1130
C$=RIGHT$CC$,LENCC$)-L)
1140
IF
8=1
THEt·j
C$="-"+C$
Il
:;(1
PI":
1
HT
:
FR
1
tH"
A~JS~·JER="
.;
C$
:
PR
1
NT
116(1
[:$=1111.
A$=IIII
. 1::$=1111:
;:'::$:::1111
1165
A=0B=0
C=0D=OS=0:X=0:Y=0
11721
CiOT020
118(1
am
***SUBTRACTIOH***
?123456789012
??57943572
AN8WER=
123398845440
207

Table of Contents

Related product manuals