Digit Fifth Powers

C++, Matlab. This is the Problem 30 from Project Euler.

Question: Surprisingly there are only three numbers that can be written as the sum of fourth powers of their digits:
1634 = 1^4 + 6^4 + 3^4 + 4^4
8208 = 8^4 + 2^4 + 0^4 + 8^4
9474 = 9^4 + 4^4 + 7^4 + 4^4

As 1 = 1^4 is not a sum it is not included.

The sum of these numbers is 1634 + 8208 + 9474 = 19316.

Find the sum of all the numbers that can be written as the sum of fifth powers of their digits. Link to the page.

Solution: Firstly, I found the maximum number based on input digit number for next counting loop. The next algorithm checks the matches with digit powered numbers. If found, it takes it into the dynamic array. Then, it sums up, and shows the result.

For n = 5 (fifth power), the result is 443839.

The numbers: 4150, 4151, 54748, 92727, 93084, and 194979.

MATLAB version;