Rem; Input; Print; End - Casio FX-890P Owner's Manual

Casio personal computer owner's manual
Table of Contents

Advertisement

of the data read from line 180, followed by the square root and cube root of the sum.
Program execution is terminated when the operator enters a zero.
10 S=0
20 RESTORE
30 INPUT N
40 IF N>5 THEN N=5
50 IF N=0 THEN GOTO 130
60 FOR I=1 TO N
70 READ X
80 S=S+X
90 NEXT I
100 GOSUB 140
110 PRINT S;Y;Z
120 GOTO 10

130 END

140 REM SQUARE/CUBE ROOT
150 Y=SQR S
160 Z=CUR S
170 RETURN
180 DATA 9,7,20,28,36

5.5.1 REM

The REM command (line 140) is actually short for the word "remarks". The computer
disregards anything following a REM command, and so it is used for such purposes
as labels in order to make the program list itself easier to follow. Note that a single
quotation mark ( Shift ' ) can be used in place of the letters "REM".

5.5.2 INPUT

The INPUT command (line 30) is used to allow input from the computer's keyboard
during program execution. The data input are assigned to a variable immediately
following the INPUT command. In the above example, input numeric data are
assigned to the variable N. Note that a string variable must be used foe a string input.
EXAMPLE:
10 INPUT A$ (string input)

5.5.3 PRINT

The PRINT command (line 110) is used to display data on the computer's display. In
this example, this command is used to display the results of the sum, square root and
cube root calculations.
5.5.4 END
The END command (line 130) brings execution of the program to an end, and can be
included anywhere within the program.
5.5.5 IF – THEN
The IF/THEN command (lines 40 and 50) is used for comparisons of certain
conditions, basing the next operation upon whether the comparison turns out to be
true of false. Line 40 checks whether or not value assigned to N is greater than 5,
Clear current total assigned to S
Specifies read operation should begin with 1
Input the number of data items to be read
Input of values greater than 5 should be treated as 5
Jump to line 130 when input is zero
This section is repeated the number of times specified
by operator input in line 30
Branch to subroutine starting from line 140
Displays contents of variables S,Y,Z
Jump to line 10
Program end
Remarks
Square root calculation
Cube root calculation
Return to statement following the GOSUB
Data read by READ statement in line 70
33
st
data item

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents