How Many Right Triangles Are Possible - Sharp MZ-80A Owner's Manual

Hide thumbs Also See for MZ-80A:
Table of Contents

Advertisement

40
How Many
Right Triangles are Possible?
Now, let's generate
a program that picks up
positive integers
from
1 to 20
to
meet the Pythagorean
theorem
A2
=
B2
+
C2
.
10 PRINT"
a
"
20
PRINT
"
N
"
30 PRINT
"
'
"
40 PRINT"
B
\ A"
50 PRINT"
\
"
60 PRINT
"
L
_ _ _
\
"
70
PRINT
"
80
PRINT
"
C"
90
PRINT
:
PRINT "POSITIVE INTEGERS
TO
MEET PYTHAGOREAN THEOREM"
110 PRINT: PRINT" S A"," S B",
"
S C"
120 FOR
A=
1 TO 20
130 FOR B
=
1 TO
20
140
FORC
=
1 TO
20
150 IFA*A-B*B-C*C
=
0 THEN
PRINT
A.
B,
C
160 NEXT
C, B,
A
180
END
You already know the
meaning
of line number
10. Try
to draw
carefully
so
that a fine triangle is formed between
line numbers 20
through
80.
At line
numbers 120 through 160, the FOR
....
NEXT
loop is triple. The
equation
shown
at
line number
150
is repeated
8000
times (20 x
20 x
20)
with C from 1 to 20
at A
=
1 and
B
=
1, and
with
C
from 1
to
20
at
A
=
1 and
B
=
2, and so on.
This operation requires a considerable period of
time
for its completion.
w
I
How
many
times
does
>
he
have to turn
the
i
pedals
in order
to
rotate
p
.
7 point
A
through
one

Advertisement

Table of Contents
loading

Table of Contents