Rolling dice – Sharp EL-9900 User Manual

Page 49

Advertising
background image

12

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 roll a set of dice.

2.

Create a new program with the name ROLLING. 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:

Print “NUMBER

PRGM A 1

PRGM A 2 2ndF

OF DICE

A-LOCK N

U

M B E R

SPACE O F SPACE D

I C E ENTER

Input N

PRGM A 3 ALPHA N ENTER

0

⇒K

0

STO ALPHA K

ENTER

Label A

PRGM B 0 1 ALPHA A ENTER

Print int (

PRGM

A 1 MATH B 5 (

random

× 6)+1

MATH C

1

×

6

)

+ 1 ENTER

K+1

⇒K

ALPHA K + 1

STO ALPHA K

ENTER

If K<N

PRGM B

0 3 ALPHA K MATH

Goto A

F 5

ALPHA N PRGM B 0 2

ALPHA

A

ENTER

End

PRGM

A

6

ENTER

ROLLING DICE

Advertising