Display variable and string on same line (TI-Basic)

jaysoncopes picture jaysoncopes · Oct 15, 2014 · Viewed 16.4k times · Source

In most programming languages, you can mix and match strings with variables during output. However, I can't seem to find a good way to do so. Here is my code:

Prompt A,B
√(A^2+B^2)->C
If iPart(C)≠C
Then
Disp "C = √(",C
Else
Disp "C = ",C
End
Goto ED

Label ED

Unfortunately, with this code, it ends up printing like so:

A? 3
B? 5
C = √(
              34
            Done

This is not what I want. I would love to be able to have it print C = √(34), but I currently can't find any way to mix variables and strings. Any help would be appreciated.

Answer

Richard Chase picture Richard Chase · Jul 31, 2015

I know this is a little late, but it might help others as well. The Output( command would be used in this case. The home display is 8x16, so

Prompt A,B
√(A^2+B^2)->C
If iPart(C)≠C
Then
Disp "C = √(",C
Output(3,7,C
Else
Disp "C = ",C
End