Befunge
![]() |
Squares (1) | Chad Fowler |
55+82+*99*88*77*66*55*44*33*22*11*>v .: ^_@ |
Outputs the squares from 1 to 10.
Note that formatting is important. Explanation: push 5, push
5, pop/pop/add/push, push 8, push 2, pop/pop/add/push,
pop/pop/multiply, push, etc... (until ">") go right, go down,
":" means duplicate of stack, compare to 0--if 0 go right,
otherwise left, go up ("^"), pop and print as integer (continue
up), go left, go down (looping until "@" on nonzero condition,
which means "end") |
Squares (2) | Chad Fowler |
a987654321>v .: *v :v ^_@ |
Outputs the squares from 1 to 10. .
Refactored :-) |