quadratic formula program trouble

So I made this program to solve the quadratic formula. This program also displays the discriminant of the quadratic formula. the formula is this (-B ± √(B^2 -4AC))/2A and the discriminant is B^2 -4AC. For some reason, the program only will spit out the correct answers when A is 1. There are no syntax errors that will prevent the code from running. Can I have a fresh set of eyes look at it?

Prompt A
Prompt B
Prompt C
(B)²-4AC→Z
(­B-√(Z))→Y
(­B+√(Z))→X
Disp "DISCRIMINANT"
Disp Z
Disp "X: "
(X)/2*A→D
(Y)/2*A→E
Disp D,E
2

1 Answer

I see two issues with your code.

  1. You're using B, not -B
  2. You're doing /2*A, not /(2*A). The ti83/84 family of calculators evaluates multiplication and division strictly from left to right. So /2*A is "divide by two, then multiply by A".

I would cleanup your code as follows:

Prompt A,B,C
B²-4AC→Z
Disp "DISCRIMINANT:", Z
-B-√(Z)→Y
-­B+√(Z)→X
X/(2A)→D
Y/(2A)→E
Disp "X:",D,E
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like