HP NW280-200X User Manual page 474

Prime graphing calculator
Table of Contents

Advertisement

FOR DOWN
FOR DOWN STEP
WHILE
468
FOR Y FROM Ymin TO Ymax STEP yincr DO
color := FLOOR(X^2+Y^2) MOD 4;
PIXON(X,Y,color);
END;
END;
FREEZE;
END;
Syntax: FOR var FROM start DOWNTO finish DO commands
Sets variable var to start, and for as long as this variable
is less than or equal to finish, executes the sequence of
commands, and then adds 1 (increment) to var. If DOWNTO
is used the start value of the variable is decreased until the
finish value is reached.
Syntax: FOR var FROM start DOWNTO finish [STEP
increment] DO commands
Sets variable var to start, and for as long as this variable
is less than or equal to finish, executes the sequence of
commands, and then adds 1 (increment) to var. If DOWNTO
is used the start value of the variable is decreased until the
finish value is reached.
Syntax: WHILE test DO commands END;
Evaluate test. If result is true (not 0), executes the
commands, and repeat.
Example: A perfect number is one that is equal to the sum
of all its proper divisors. For example, 6 is a perfect
number because 6 = 1+2+3. The example below returns
true when its argument is a perfect number.
EXPORT ISPERFECT(n)
BEGIN
LOCAL d, sum;
2
d;
1
sum;
WHILE sum < = n AND d < n DO
IF irem(n,d)==0 THEN
Programming

Advertisement

Table of Contents
loading

Table of Contents