Exponentiation with infix operators in (or operating on) the base: Difference between revisions
Exponentiation with infix operators in (or operating on) the base (view source)
Revision as of 08:30, 18 June 2022
, 1 year agoApplesoft BASIC
(Exponentiation with infix operators in (or operating on) the base in various BASIC dialents (BASIC256, Gambas, QBasic, Run BASIC, True BASIC, PureBasic, XBasic and Yabasic)) |
(Applesoft BASIC) |
||
Line 187:
=={{header|BASIC}}==
==={{header|Applesoft BASIC}}===
<lang gwbasic>S$=" ":M$=CHR$(13):?M$" X P -X^P -(X)^P (-X)^P -(X^P)":FORX=-5TO+5STEP10:FORP=2TO3:?M$MID$("+",1+(X<0));X" "PRIGHT$(S$+STR$(-X^P),8)RIGHT$(S$+STR$(-(X)^P),8)RIGHT$(S$+STR$((-X)^P),8)RIGHT$(S$+STR$(-(X^P)),8);:NEXTP,X</lang>
{{out}}
<pre>
X P -X^P -(X)^P (-X)^P -(X^P)
-5 2 25 25 25 -25
-5 3 125 125 125 125
+5 2 25 25 25 -25
+5 3 -125 -125 -125 -125
</pre>
==={{header|BASIC256}}===
<lang BASIC256>print " x p | -x^p -(x)^p (-x)^p -(x^p)"
|