You know you need to write a function. You know the function should return a value (the result). A number to a power seems to be 2 separate values; so your function needs to take two parameters. Inside the function, you'll have to do some addition a number of times (by using a loop, like you suggested).
Give it a shot and post your code here when you have a specific problem.