Simple Program Question (TI-84 calculator)

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2009-12-31T16:26:25Z Indexed on 2010/03/16 11:06 UTC
Read the original article Hit count: 547

Filed under:
|

I wrote a program (on my TI-84 calculator) to satisfy the following exercise:

Write a program that will print all solutions of the inequality ax + b < c, where a, b, and c are entered by the user. In this program the domain of x will be a set of consecutive integers, where the smallest and largest members of the set will also be entered by the user. (Hint: Use a FOR . . . NEXT loop to test each integer from smallest to largest.)

This is the code I have:

:Input "A=",A
:Input "B=",B
:Input "C=",C
:Disp "DOMAIN FOR X"
:Input "MIN=",D
:Input "MAX=",E
:For(X,D,E,1)
:If AX+B<C
:Disp X
:End

I sort of figured it out by chance; I don't really know how 'If' works inside 'For.' I wanted to have it tell me if there is no solution, though, so I tried:

:Input "A=",A
:Input "B=",B
:Input "C=",C
:Disp "DOMAIN FOR X"
:Input "MIN=",D
:Input "MAX=",E
:For(X,D,E,1)
:If AX+B<C
:Then
:Disp X
:Else
:Disp "NO SOLUTION"
:End

But this returns the value for "MIN=" Why is this? Can anyone help me understand these work?

© Stack Overflow or respective owner

Related posts about calculator

Related posts about ti-84