Programming
637
Example: Using Alternative Approaches
Example: Using Alternative Approaches
Example: Using Alternative Approaches
Example: Using Alternative Approaches
The example in the
Previews
module shows a program that prompts the user to enter an
integer, sums all integers from 1 to the entered integer, and displays the result. This
section gives several approaches that you can use to achieve the same goal.
Example 1
Example 1
Example 1
Example 1
This example uses
InputStr
for input, a
While...EndWhile
loop to calculate the result, and
Text
to display the result.
Ê
Prompts for input on Program I/O screen.
Ë
Converts string entered with
InputStr
to an expression.
Ì
Loop calculation.
Í
Displays output in a dialog box.
Ê
Ë
Ì
©Ì
©Ì
Ì
Í
:prog1()
:Prgm
:InputStr "Enter an integer",n
:expr(n)
!
n
:0
!
temp:1
!
I
:While i
{
n
: temp+i
!
temp
: i+1
!
I
:EndWhile
:Text "The answer is "&string(temp)
:EndPrgm
Summary of Contents for TI-89 Voyage 200
Page 1: ...TI 89 Titanium Graphing Calculator...
Page 35: ...Getting Started 35 2 B u s i n e s s D B D B Press Result...
Page 44: ...Getting Started 44 3 0 D B D D Press Result...
Page 45: ...Getting Started 45 B D D 2 0 0 2 Press Result...
Page 46: ...Getting Started 46 D B Scroll down to October and press D 1 9 Press Result...
Page 60: ...Getting Started 60 Example Set split screen mode to TOP BOTTOM Press Result 3 B D...
Page 63: ...Getting Started 63 2 D B 4 Press Result...
Page 453: ...Differential Equation Graphing 453...
Page 468: ...Tables 468...
Page 539: ...Data Matrix Editor 539...