#include string small[] = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; string ty[] = { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; void say_number(const int N) { if (N < 0) { print("minus "); say_number(- N); } else if (N < 20) print(small[N]); else if (N < 100) { const int first = N / 10; const int second = N % 10; print(ty[first]); if (second != 0) { print("-"); say_number(second); } } else if (N < 1000) { const int first = N / 100; const int second = N % 100; say_number(first); print(" hundred"); if (second != 0) { print(" and "); say_number(second); } } else if (N < 1000000) { const int first = N / 1000; const int second = N % 1000; say_number(first); print(" thousand"); if (second != 0) { if (second < 100) print(" and "); else print(" "); say_number(second); } } else if (N < 1000000000) { const int first = N / 1000000; const int second = N % 1000000; say_number(first); print(" million"); if (second != 0) { if (second < 100) print(" and "); else print(" "); say_number(second); } } else { const int first = N / 1000000000; const int second = N % 1000000000; say_number(first); print(" billion"); if (second != 0) { if (second < 100) print(" and "); else print(" "); say_number(second); } } } int main() { print("Type a number: "); const int number = read_int(); say_number(number); new_line(); }