How to translate a number into a string in natural language, so that, for example, from 123 get the string “one hundred twenty three”?

Preferably without using array() .

  • @David Kern; If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Vitalina
  • one
    I think it means "Write the number with the line" 123 = "one hundred twenty three" - IVsevolod
  • Thanks, I already wrote the code. I'm glad if you help improve the code. codepen.io/DavidKern/pen/pvLobM the problem is when I dial the number 316234 to admit that he does not write sixteen and writes three hundred one six I tried to insert if but then there were problems on other numbers. Thanks for the help :) - David Kern
  • need to encode the rules of the language. On CodePen you go on, I do not know him. In Russian, perhaps, there will be another logic: its word for thousands, hundreds, tens> = 2, its names for numbers from 11 to 19. And it’s good if the cases are not needed :) A bicycle was found for the Russian language. - Sergiks

1 answer 1

No The machine does not know what to compare numbers