Sharp PC-1500 Instruction Manual page 54

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

Advertisement

A
ll
and more about Sharp PC-1500 at
http:/lwww.PC-
1500.info
10 FOR
I
=
1
TO
8
10
I
=
1
20
12 IF
I
>
B
THEN 100
[
wme
$tatements
t
o
be
repeated )
20
I
some
statements to
be
repeated
I
90
NEXT
90 I
=
I+
1
100
END
92 GOTO
12
100
END
Our
second sa
mple
program
illustrates
how one
m:iy prograrn
a "genetal
loop",
whose
repcti
·
tions
arc
controlled 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
process ing. The
loop
is
executed
N
t
imes,
unless
N
is
less
than
or equal
to
zero,
in which
case
we
END
without further
proce.sing.
Program
Listing:
10
N
=
O:V
=
O:
T
=
O
:
A
s
O
20
WAIT 0
30
INPUT
"
HOW
MANY VALUES?
40
IF N
=
0 TH EN
GOTO
999
50
FOR
I
=
1 TO
N
60
CLS
: CURSOR 0
70
INPUT
V
BOT
,,,
T+V
90
NEXT
I
100
WAIT
:
CLS
:
CURSOR 0
110 A
=
T
/
N
120
PAUSE
"TOTAL
"'
"; T
130
PR
INT
"AVERAGE
=
";
A
999
END
Keystrokes:
";N
rur_uOOL€
l[.1Jr••"'
1
orn1
=1rn0i<1n1CJ
UJ1 =1w
I
SHIFT!
CJ
QOC:::;J
00
l••TC•I
m
rn oo
mco
CD
oo
@
..
1
rn
oo
mm mro CD
''""'
1C"J
nnruoo1 ...
•«1
oo
rn oo
c.o
1
....
°'1mmmODoom1
••
IF,,m
1
...
.,.1
,
...
,,,, c::J,
...
,
,
.,CD
['A]
l••
•U)
Le
]
co ru
OD
[
=
]
OD
w
OD 00
QD
m
CQJ
CD
CQJ
rnrnrn1• ....
1
CD
CID
CI!
EQJ
®CD C:O CD
C!J
CQJ
QD
tanul
(GJ
00
[CJ [I]
(TI I
$1ft1rI
0
a:J
OJJOOIIJ
[Q]
00
l11m•l
[ZJ
(§j
moo
w
OD
CTI
00 l•••t•I
52
Do
not sale this
PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents