106
107
condition is true, execution advances to the statement
following
.
If the condition is not true,the statement
following
.
is skipped and execution jumps to the
statement following the next “ : ” or “ ”.
A statement is a calculation formula ( sin A x 5, etc.) or a
program command (Goto ,prog, etc.), and everything up to
the next “ : ” or “ ” is rgarded as one statement.
If an input numeric value is greater than or
equal to zero, calculate the square root of
that value. If the input value is less than zero,
reinput another value.
Program
Lbl , 1, : ,?, , A , : ,A ,
≥
, 0,
,
√
,
A , ,Goto , 1 16 steps
In this program, the input numeric value is stored in
memory A , and then it is tested to determine whether it is
greater than, equal to or less than zero. If the contents of
memory A are greater than or equal to 0 (not less than zero
), the statement (calculation formula) located between “
”
and “ ” will be executed, and then Goto 1 returns
execution to Lbl 1. If the contents of memory A are less
than zero, execution will skip the following statement to the
next “ ” and return to Lbl 1 by Goto 1.
Calculate the sum of input numeric values. If
a 0 is input, the total should be displayed.
Program
0, ,B,: ,
Lbl , 1, : ,? ,A , : ,A , = , 0,
,Goto , 2,:,
A,+,B, ,B,:,Goto,1,:,
Lbl ,2 ,:,B 31 steps
In this program, a 0 is first stored in memory B to clear it for
calculation of the sum. Next, the value input by “? A ” is
stored in memory A by “A=0
” and it is determined
whether or not the value stored in memory A equals zero. If
A = 0 , Goto 2 causes execution to jump to Lbl 2. If
memory A does not equal 0 , Goto 2 will be skipped and
the command A+ B B which follows “:” is executed, and
Calculate y=ax+b when the value for x
changes each time , while a and b can also
change depending upon the calculation.
?, , A , : ,?, ,B, : ,Lbl, 1,:
,?, ,
X
,:,
A ,
x
,
X
, +, B , Goto , 1 23 steps
When this program is executed, the values for a and b are
stored in memories A and B respectively. After that, only
the value for x can be changed .
In this way an unconditional jump is made in accordance
with “Goto “and “Lbl”, and the flow of program execution is
changed. When there is no “Lbl
n
“ to correspond to a
“Goto
n
“ , an error (Go ERROR) is generated.
Conditional jumps
The conditional jumps compare a numeric value in memory
with a constant or a numeric value in another memory. If
the condition is true, the statement following the
is
executed, and if the condition is not true, execution skips
the statement and continues following the next “:” or “ ”,
Conditional jumps take on the following form :
Left side Relational Right side
Statement { }* Statement
operator
* Anyone can be used.
One memory name (alphabetic character from A through Z
), constant numeric values or calculation formulas (Ax2, D-
E, etc.) are used for “left side “ and “right side “,
The relational operator is a comparison symbol. There are
6 types of relational operators: = ,
≠
,
≥
,
≤
, > , < .
Left side = right side (left side equals right side )
Left side
≠
right side (left side does not equal right side )
Left side
≥
right side (left side is greater than or equal
to right side )
Left side
≤
right side (left side is less than or equal to right
side )
Left side > right side (left side is greater than right side )
Left side < right side (left side is less than right side )
The “
” is displayed when
are pressed. If the
Summary of Contents for CA756
Page 24: ...38 Parenthesis calculations...
Page 27: ...41...
Page 34: ...48...
Page 40: ...54...
Page 42: ...56...
Page 45: ...59 Binary octal decimal hexadecimal conversions Negative expressions...
Page 46: ...60 Basic arithmetic operations using binary octal decimal and hexadecimal values...
Page 58: ...82 83 first...
Page 79: ...125 124...
Page 80: ...127 126...
Page 81: ...129 128 Program Calculations...
Page 82: ...131 130 Error Message Table...