Exponentiation with infix operators in (or operating on) the base: Difference between revisions
Content added Content deleted
m (→{{header|Phix}}: added syntax colouring the hard way, phix/basics) |
(add FreeBASIC) |
||
Line 194: | Line 194: | ||
5 2 -x**p 25 -(x)**p 25 (-x)**p 25 -(x**p) -25 |
5 2 -x**p 25 -(x)**p 25 (-x)**p 25 -(x**p) -25 |
||
5 3 -x**p -125 -(x)**p -125 (-x)**p -125 -(x**p) -125 |
5 3 -x**p -125 -(x)**p -125 (-x)**p -125 -(x**p) -125 |
||
</pre> |
|||
=={{header|FreeBASIC}}== |
|||
<lang freebasic>print " x p | -x^p -(x)^p (-x)^p -(x^p)" |
|||
print "----------------+---------------------------------------------" |
|||
for x as integer = -5 to 5 step 10 |
|||
for p as integer = 2 to 3 |
|||
print using " ## ## | #### #### #### ####";_ |
|||
x;p;(-x^p);(-(x)^p);((-x)^p);(-(x^p)) |
|||
next p |
|||
next 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> |
</pre> |
||