Sharp PC-1500A Instruction Manual page 54

Hide thumbs Also See for PC-1500A:
Table of Contents

Advertisement

All
and
more
about Sharp
PC-1500
at
http://www.PC-1500.info
10
FOR I
=
1 TO 8
10 I
=
1
20
12 IF
I >8 THEN
100
[
some statements
to
b•
repeated
]
20
[
some
statements
to
be
repeated
J
90
NEXT
I
90
I
=
I+
t
100 END
92 GOTO 12
100
END
Our
second
sample program
illustrates
how
one may program a
"general
loop••,
whose
repeti·
tions
arn
controlle<l
by the value
of a
variable. We
begin by
asking
the
user
how many
numbers
he/she plans to
enter.
We
store this number
in
a variable N
and
we
proceed
to loop through
the
statements
which take
in
a number for processing. The loop
is
executed N
times. unless N
is
less
than o
r
equal
to
zero,
in
which case we
END w·ithout
further processing.
Program
Listing:
10
N
=
0
:
V
=
0 :
T
=
0
:
A
=
0
20
WAIT
0
30
INPUT "HOW
MANY VAILUES?
";
N
40
IF
N
=
0
THEN
GOTO
999
50
FOR
I=
1
TO
N
60
CLS
:
CU RSOR
0
70
INPUT V
BO
T
=
T+
V
90 NEXT
I
100
WA
IT
:
CLS
:
CURSOR
0
1
10
A
=
TI
N
120 PAUSE
"
TOTAL
=
";
T
130
PR
INT
"AVERAGE
=
"
.
;
A
999
END
K eystrokes:
OJ[I]
(]j]I
=
l
[I] l
"'•n
l 0
u::.Ji
=
IOOl•••nl
L.015:'.JI
=
100
1
••
,,,1
o
m
1
"
1
oo
t••TE•t
a:;
oo
oo
mm
CD
rn
t••n•I
rn rn
moo
m
lJiJ CD
,
..
,,,1
c::im
rn
oo
t•••c•1
oo m
on
m
, ...
c•1
mm
m
lJiJ
oo
m
,
..
,,,, m
ISP•«I
!
SHIFT
)
c:J
l
sHl.FT
l
(IJQLJ
!tNTERI
m
m
mm
CID
w
rn
m
CEJ
oo
CEJ
m
rn
m
CID
rn
rn rn
,
..
.,,.,
rn
rn
QJ
OD OD CD
I
::
I
OJ
CD QD
[![)
,,
.,
••
,
rn rnmmm
'
'"'"
10
m
OD
mm oomrn
1rN•r•1
rn
rn co oo m
CiD
co
m
,
,.,..1
52
Do not sale
this
PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents