Resources
Policy
Links
Tasks
Calculators
Support Documents

Calculators | Texas Instruments - Mathematics | Programming Conditional Statements

Programming Conditional Statements

The difference between the 2 numbers should now be stored to variable C.
: A - B C

The value of C should now be checked.
Type in using 2nd   Test to obtain the equal sign.

: If C = 0

: Then


Clear the home screen so that the screen is not cluttered when you display that A equals B

: Disp ìA = Bî
: Pause

The if then loop can now be ended.
: End




   
Further testing of C can now take place.
The value stored to C can be displayed by not enclosing in inverted commas.

: If C > 0
: Then
: Disp ìA IS GREATERî
: Disp ìTHE DIFFERENCEî, C
: Pause

 
   
: Else:
: If C < 0
: Disp ìB IS GREATERî
: Disp ìTHE DIFFERENCEî, -C
: Pause
: End
 
   
The program could now be executed, by return to the home screen, pressing PRGM and choosing 6: COMPARE

On entering the program repeats.

 

[ TOP ] [ HOME ] [ SITE MAP ]
Copyright © Department of Education, Western Australia. All Rights Reserved.
updated January 2002