Numbers to English

Published by Matt in

Write a function that accepts a positive integer between 0 and 999 inclusive and returns a string representation of that integer written in English.

Examples

numToEng(0) ➞ "zero"

numToEng(18) ➞ "eighteen"

numToEng(126) ➞ "one hundred twenty six"

numToEng(909) ➞ "nine hundred nine"

Notes

  • There are no hyphens used (e.g. "thirty five" not "thirty-five").
  • The word "and" is not used (e.g. "one hundred one" not "one hundred and one").
Watch a quick demo on how Edabit works.