- #1

- 9

- 0

## Homework Statement

need to do a power function of any number to any power WITHOUT using the power key

aka i need to replicate the power function using only loops and multiplication

for example, compute 5 to the third power by doing 5*5*5 not 5^3

but i don't know how to tell matlab to multiply a number by itself n times

## Homework Equations

for loops

## The Attempt at a Solution

Code:

```
num = input(' value? ')
n = input( ' power? ')
for num = 1:n
num = num*num;
end
disp(num)
```