Problem: * number to words

Write a program that converts a number in the range of [0 ... 100] into text.

Sample Input and Output

Input Output
25 twenty five
42 forty two
6 six

Hints and Guidelines

First check for one-digit numbers and if the number is one-digit, print the appropriate word for it. Then check for two-digit numbers. Print them in two parts: left part (tenth = number / 10) and right part (units = number % 10). If the number has 3 digits, it must be 100 and can be considered as a special case.

Testing in the Judge System

Test your solution from the example here:

results matching ""

    No results matching ""