Syntax error with a calculator

Marsouth -  
ccm81 Posted messages 11033 Status Membre -
Hello,

Configuration: Mac OS X (10.9.2) / Safari 7.0.2
I would like to set up a code so that if a number x is less than 3 then the calculator should calculate x squared minus 5, otherwise it should calculate 5 times x.

Here is my code
------------------------

Prompt X
If X<3
then X2-5
else Xx5
disp X
End

----------------------
Every time I try this it shows me "syntax error", I don't understand where the problem comes from.. if you could help me that would be great thanks in advance!

2 réponses

Marsouth
 
I specify that it is a TI 82 Texas Instrument.
0
ccm81 Posted messages 11033 Status Membre 2 434
 
Hello

1. The error comes from the fact that there are missing ":" after then and else
2. Once this is corrected, your program will always display the value of X entered (with prompt)
3. So Then:X² sto Y etc ..
and after the end (of the if ... then .... else ...) display the value of Y

Good luck
0