Download  Print this page

Loop Commands - HP 39gII User Manual

Graphing calculator.
Hide thumbs

Advertisement

Loop commands

FOR...FROM...TO...
DO...END
268
causes the name of the selected person will be printed to
the terminal.
Syntax: FOR var FROM start TO finish [STEP increment] DO
commands
END;
Sets variable var to start, and for as long as this variable's
value is less than or equal to finish, executes the sequence
of commands, and then adds 1 (increment) to var.
Example 1: This program determines which integer from
2 to N has the greatest number of factors.
EXPORT MAXFACTORS(N)
BEGIN
LOCAL cur, max,k,result;
1 max;1 result;
FOR k FROM 2 TO N DO
SIZE(idivis(k))
IF cur > max THEN
cur
max;
k
result;
END;
END;
MSGBOX("Max of "+ max +" factors
"+result);
In Home, enter
MAXFACTORS(100).
Example 2: This program draws an interesting pattern on
the screen.
cur;
for
Programming

Advertisement

Table of Contents

   Also See for HP 39gII

   Related Manuals for HP 39gII

Comments to this Manuals

Symbols: 0
Latest comments:
  • Peterg Dec 29, 2018 01:11:
    Me interesan los Manuales Hp para usarlo en clases