Archive / 2019 / Selection Test
Numbers Numbers Everywhere!
Given an integer N, output it in words.
Rules to print the words:
- All letters should be printed in lowercase
- Use only the following words, each separated by a space to generate the output
| | | | | | |———–|—————|———–|———–|— | | zero | ten | twenty | hundred | | | one | eleven | thirty | thousand | | | two | twelve | forty | million | | | three | thirteen | fifty | billion | | | four | fourteen | sixty | | | | five | fifteen | seventy | | | | six | sixteen | eighty | | | | seven | seventeen | ninety | | | | eight | eighteen | | | | | nine | nineteen | | | |
Input Format
A single integer N.
Output Format
N in words.
Constraints
- 0 \(\leq\) N \(\leq\) 109
Sample Input 0
13
Sample Output 0
thirteen
Sample Input 1
70
Sample Output 1
seventy
Sample Input 2
94
Sample Output 2
ninety four
Sample Input 3
100
Sample Output 3
one hundred
Sample Input 4
123456789
Sample Output 4
one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine
Sample Input 5
1000000000
Sample Output 5
one billion
Sample Input 6
1111
Sample Output 6
one thousand one hundred eleven
Open on HackerRank ↗ · Markdown source · Back to the archive