EasyManuals Logo

HP HP-28S User Manual

HP HP-28S
341 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #272 background imageLoading...
Page #272 background image
• FOR
...
STEP
and
FOR
...
NEXT (definite loops). SORT uses two
counters: - 1 STEP
decrements
the
counter
for
the
outer
loop
each
iteration; NEXT
increments
the
counter
for
the
inner
loop
by
1
each
iteration.
Program
-=:::
DUP
SIZE 1
-
1
FO~:
.j
.j
FO~:
k
k
GETI
-t
n1
'$:
GETI
-t
n2
.
;:;:
DPOP
IF
n1
n2
>
THEt·j
k
n2
PUTI
n1
PUT
Et·m
::;:.
:~:.
t·jE::<T
-1
STEP
:~:.
I ENTER I
~
SORT
I STO I
Comments
Begin
the
program.
From
the
next-to-last
position
to
the
first position,
Begin
the
outer
loop
with
counter
J.
From
the
first
position
to
the
jth
position,
Begin
the
inner
loop
with
counter
k.
Get
the
kth
number
in
the
list
and
store it in a local variable n
j
.
Begin
outer
defining
program.
Get
the
next
number
in
the
list
and
store it in a local variable
n2.
Begin
inner
defining
program
.
Drop
the
counter.
If
the
two
numbers
are in
the
wrong
order,
Then
do
the
following:
Put
the
second
one
back
in
the
kth position.
Put
the
kth
one
back in
the
next
position.
End
of THEN clause.
End
inner
defining
program.
End
outer
defining
program.
Increment
k
and
repeat
the
inner
loop.
Decrement
j
and
repeat
the
outer
loop.
End
the
program.
Put
the
program
on
the
stack.
Store
the
program
as SORT.
28:
Programming
Examples
271

Table of Contents

Other manuals for HP HP-28S

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the HP HP-28S and is the answer not in the manual?

HP HP-28S Specifications

General IconGeneral
BrandHP
ModelHP-28S
CategoryCalculator
LanguageEnglish

Related product manuals