The Puzzle
You have to write a program or function p(n) that returns the square of what is entered into it and you may assume that the input is a non-negative integer. Put in simpler terms, return n2.
Rules
- You are not allowed to use
*
or/
(or any other power or square root operator, such asPOW
orSQRT
, if your program contains such functions) - You may not use a loop, or use a constructions that is similar to a loop. Example of loop like constructions are
GOTO
and recursion.
Example
Function p(n)
Dim r()
ReDim r(n)
p = Len(Join(r, Space(n)))
End Function
Be create and (ab)use the functions and features given to you by your language of choice.