Texas Instruments TI-89 Manual Do Utilizador
![Texas Instruments](https://files.manualsbrain.com/attachments/b46f99d826b2b0e0e5f558c5fb6483942eb9216b/common/fit/150/50/c15ea36eb1fb1cce99a3b94668675bfc78ce832d8d727d9a7bb51a125510/brand_logo.gif)
Programming
640
Example 4
Example 4
Example 4
Example 4
This example uses built-in functions to calculate the result without using a loop.
Ê
Prompts for input on Program I/O.
Ë
Calculates sum.
Ì
Displays output on Program I/O screen.
Note:
Because
Input
returns
n
as a number, you do not need to use
expr
to convert
n
.
Ê
Ë
Ì
:prog4()
:Prgm
:Input "Enter an integer",n
:sum(seq(i,i,1,n))
!
temp
:Disp temp
:EndPrgm
Function
Used in this example to:
seq
Generate the sequence of integers from 1 to n.
sum
Sum the integers in the list generated by seq.
seq(expression
,
var
,
low
,
high
[,
step
]
)
Ê
expression used to generate the sequence
Ë
variable that will be incremented
Ì
initial and final values of
var
Í
increment for var ; if omitted, uses 1
Ê
Ë
Ì Ì
Í