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
Ê
Ë
Ì Ì
Í
Содержание Voyage 200
Страница 36: ...Getting Started 36 D B D B Press Result ...
Страница 45: ...Getting Started 45 3 0 D B D D B D Press Result ...
Страница 46: ...Getting Started 46 D 2 0 0 2 D B Scroll down to October and press Press Result ...
Страница 60: ...Getting Started 60 B D Press Result ...
Страница 139: ...Previews 139 8 Complete the operation Press 2 d Steps and keystrokes Display 5 f 2 ...
Страница 181: ...Operating the Calculator 181 From the Keyboard From the Keyboard From the Keyboard From the Keyboard ...
Страница 453: ...Differential Equation Graphing 453 ...
Страница 468: ...Tables 468 ...
Страница 515: ...Split Screens 515 Note Both Top Bottom and Left Right splits use the same methods to select an application ...
Страница 777: ...Activities 777 ...