5 kyu

Integer to English

144 of 656Chogos

Description:

For a given positive integer convert it into its English representation. All words are lower case and are separated with one space. No trailing spaces are allowed.

To keep it simple, hyphens and the writing of the word 'and' both aren't enforced. (But if you are looking for some extra challenge, such an output will pass the tests.)

Large number reference: http://en.wikipedia.org/wiki/Names_of_large_numbers (U.S., Canada and modern British)

Input range: 1 -> 10**26 (10**16 for JS)

Examples:

int_to_english(1) == 'one'

int_to_english(10) == 'ten'

int_to_english(25161045656) == 'twenty five billion one hundred sixty one million forty five thousand six hundred fifty six'
int_to_english(1) == 'one'

int_to_english(10) == 'ten'

int_to_english(25161045656) == 'twenty five billion one hundred sixty one million forty five thousand six hundred fifty six'
intToEnglish(1) == 'one'

intToEnglish(10) == 'ten'

intToEnglish(25161045656) == 'twenty five billion one hundred sixty one million forty five thousand six hundred fifty six'

or

int_to_english(25161045656) == 'twenty five billion one hundred sixty-one million forty-five thousand six hundred and fifty-six'
int_to_english(25161045656) == 'twenty five billion one hundred sixty-one million forty-five thousand six hundred and fifty-six'
intToEnglish(25161045656) == 'twenty five billion one hundred sixty-one million forty-five thousand six hundred and fifty-six'
Strings
Algorithms

Stats:

CreatedJul 18, 2014
PublishedJul 18, 2014
Warriors Trained2077
Total Skips280
Total Code Submissions7784
Total Times Completed656
Ruby Completions144
Python Completions330
JavaScript Completions210
Total Stars125
% of votes with a positive feedback rating85% of 126
Total "Very Satisfied" Votes95
Total "Somewhat Satisfied" Votes23
Total "Not Satisfied" Votes8
Ad
Contributors
  • Chogos Avatar
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • smile67 Avatar
  • FArekkusu Avatar
  • bidouille Avatar
  • Etoneja Avatar
Ad