Sharp EL-5230, EL-5250 Use of variables, SLOPE NORMAL Y=M¡X+5 SLOPE NORMAL M¡=?, Example

Models: EL-5230 EL-5250

1 132
Download 132 pages 32.97 Kb
Page 79
Image 79
Use of variables

Chapter 7: Programming

Use of variables

Global and local variables are treated differently in the PROG mode.

The letters A – Z and θ, used on their own, represent global variables. Global variables correspond to the memories of the calculator (e.g., ‘C’ in a program means memory C of the calculator). Global variables allow your programs to use values stored in memories, or to pass variables from one program to another. Global variables also allow you to store results from programs and use them in any mode.

You can also name and use up to nine local variables (@v). Local variables retain values only in an individual program.

If a line in your program contains an equation such as Y = M1X + 5, it sets the global variable Y equal to (M1 X) + 5. On encountering this equation while running the program, if the value of the local variable M1 has not been defined earlier in the program, the calculator prompts you with the display ‘M1=?’ to enter a value for M1. The global variable X will already be set to the value last stored in that memory.

With just a little practice you will soon become proficient at typing programs into your calculator.

SLOPE :NORMALSLOPE :NORMAL Y=M¡X+5  _ Manual backgroundManual backgroundManual backgroundManual background Y=M¡X+5 Manual backgroundManual backgroundManual backgroundManual backgroundManual background _ Manual backgroundManual backgroundManual backgroundManual backgroundManual background

SLOPE :NORMALManual backgroundManual backgroundManual backgroundManual backgroundManual background M¡=? Manual backgroundManual backgroundManual backgroundManual backgroundManual background

Example

Create a simple program that requests input of the base length (B1) and height (H1) of a triangle and then calculates the area (A). After creating, RUN the program to determine the area of a triangle with a base of 4 units and a height of 3 units.

1.Preparing to create a NEW program

Procedure

Key operations

Display

Enter the PROG mode.

b 2

 

Select NEW.

1

 

Select the NORMAL program mode.

0

 

Type the program name.

AREA

 

Enter the program name.

e

AREA :NORMAL

 

 

PROGRAM?

77

Page 79
Image 79
Sharp EL-5230, EL-5250 operation manual Use of variables, SLOPE NORMAL Y=M¡X+5 SLOPE NORMAL M¡=?, Example