What does "not working mean"? Be specific. Is it giving some random junk number? Is your logic simply wrong? What is your expected output?
You're trying to find the number of ways to put N elements in M boxes, right? The answer is not as simple as M^N. I believe you want to use the formula in this link: https://math.stackexchange.com/a/192671
Your formula is is not doing this.
On line 5 you are comparing an int to an unsigned long, but this only produces a warning (and I don't think is the actual problem).
If it isn't the logic of the function that's wrong, I think the real error happens in how you're calling it.
Might be that your unsigned long is only 32-bit, but unsigned long long is correctly 64-bit. If your unsigned long long isn't big enough to hold your number, you're going to have to use big ints, as JLBorges suggests.