+4

# Challenge

Raise a number to the square using only: - While or for - Operators + - (NOT MULTIPLICATION *) Terms * Do not use modules or libraries that give the value squared * You can use the language you want ;)

12/10/2017 7:38:56 PM

The Rab-bit

+14

Python way: https://code.sololearn.com/cqWgPr2eiEFf/?ref=app

+11

https://code.sololearn.com/c522HM1YsqQC/?ref=app

+9

Using bitwise functionality and recursion https://code.sololearn.com/cFZ7O3mBez14/?ref=app

+6

Nice challenge

+6

Not working with decimal numbers yet, but with integers is ok. https://code.sololearn.com/cz16O6j32Oho/?ref=app

+4

https://code.sololearn.com/cuP03Nb6newm/?ref=app

+2

c# https://code.sololearn.com/cCjnBxB33W33/?ref=app

+2

Updated a^n power function for any(1<=n) degrees of integers (negative int.s too) https://code.sololearn.com/cIl5A4JQFLTa/?ref=app

+2

Hi. Here is my code in python. It work for negative numbers too. https://code.sololearn.com/cpX0YpB7nJnc/?ref=app

+1

@HeisAbdulaziz your code doesn't work with negative numbers if you want to raise them to even power. in example (-3)^2

+1

as i've tagged ))) // a^n=1*a*a*a*a...*a // input: a n (a>0,n>0 a,n=int) // output: a^n but it isn't pow i have some bugs

+1

oh sorry, I'm probably just blind haha

+1

Using sum of first n odd integers to give the square of n: https://code.sololearn.com/cUKbPSDr4iTi/?ref=app