Power of a Number (No ** Operator)
A trainee at a hardware firm is learning what a processor actually has to do to raise one number to a power, because the chip they are writing for can multiply but has nothing built in for powers. The exercise therefore takes the shortcuts away: you may not use the ** operator and you may not call pow(). Only multiplication is allowed.
Task: Print b raised to the power e, without ** and without pow().
Input
A single line holding two integers separated by a single space: the base b, then the exponent e. e is 0 or greater; b may be any integer.
Output
One line holding a single integer — the result. Anything raised to the power 0 is 1.
Example:
Input:
2 10
Output:
1024
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in