beautypg.com

Pythagorean triples – Sharp EL-9900 User Manual

Page 51

background image

14

Basic Keyboard/PROGRAMMING USING THE SHARP EL-9900

Copyright © 2002, Sharp Electronics Corporation. Permission is granted to photocopy for educational use only.

1.

Program the calculator to find Pythagorean triples. Pythagorean triples are

three numbers x, y, and z that satisfy x

2

+ y

2

= z

2

.

2.

Create a new program with the name PYTHAG. Enter the following program

and remember to press ENTER at the end of each line. If you make a

mistake, use the calculator’s editing features to correct the error.

3.

Enter the following program using the Advanced Keyboard:

Input N

PRGM A 3 ALPHA N ENTER

2

⇒J

2

STO ALPHA

J ENTER

1

⇒K

1

STO

ALPHA K ENTER

Label A

PRGM B 0 1 ALPHA A ENTER

If

√(J

2

+K

2

)

≠ipart

PRGM

B

0 3 2ndF

(

ALPHA J

(

√(J

2

+K

2

)) Goto B

x

2

+ ALPHA K

x

2

)

MATH F 2

MATH B 3 (

2ndF

(

ALPHA

J x

2

+ ALPHA

K x

2

)

)

PRGM B

0 2

ALPHA

B

ENTER

Print J

PRGM A

1 ALPHA J

ENTER

Print K

PRGM

A 1

ALPHA

K ENTER

Print

√(J

2

+K

2

)

PRGM

A 1 2ndF

(

ALPHA

J

x

2

+ ALPHA

K x

2

)

ENTER

Print “

PRGM A 1 PRGM A

2 ENTER

Wait

PRGM A 4 ENTER

Label B

PRGM

B 0 1 ALPHA B ENTER

K+1

⇒K

ALPHA K + 1 STO ALPHA K ENTER

If K

≤(J–1)

PRGM

B

0 3 ALPHA K MATH

Goto A

F 6 ( ALPHA J –

1

)

PRGM B 0

2 ALPHA A ENTER

J+1

⇒J

ALPHA J

+

1 STO ALPHA J ENTER

1

⇒K

1

STO ALPHA K ENTER

If J

≤N

PRGM B 0 3 ALPHA J MATH

PYTHAGOREAN TRIPLES