Express Number in Expanded Notation

Published by Helen Yu in

Create a function that takes a number and return a string with the number in expanded notation (AKA expanded form). See the resources tab for details on expanded notation.

Examples

expand(13) ➞ "10 + 3"

expand(86) ➞ "80 + 6"

expand(17000000) ➞ "10000000 + 7000000"

expand(5325) ➞ "5000 + 300 + 20 + 5"

Notes

You can expect only whole numbers greater than 0 as test input.

Watch a quick demo on how Edabit works.