Other Content

Table Of Contents
154 Calculator Application
As an example, define a function sumIntegers(x) that calculates the cumulative
sum of integers from 1 through x.
1. On the Calculator entry line, type Define sumIntegers(x)=. Do not
press Enter yet.
2. Insert the Func...EndFunc template.
From the Functions&Programs menu, select Func...EndFunc.
Calculator inserts the template.
3. Type the following lines, pressing @ or Alt+Enter at the end of each line.
4. After typing Return tmpsum, press Enter to complete the definition.
5. Evaluate sumIntegers(5) to test the function.
Defining a Program
Defining a program is similar to defining a multiple-line function. The
Prgm...EndPrgm template serves as a container for the program statements.
As an example, create a program named g(x,y) that compares two arguments.
Based on the comparison, the program should show the text x>y or xy
(showing the values of x and y in the text).
1. On the Calculator entry line, type Define prog1(x,y)=. Do not press
Enter yet.